codeception (6) Yii2中安装codeception时遇到的问题及解决方法

codeception版本 v2.1.8

shell_exec

PHP Warning: shell_exec() has been disabled for security reasons in phar...

这个原因是因为php禁用了shell_exec()函数,所以我们需要更改php.ini
找到php的配置文件

  输入whereis php命令
  php:/usr/bin/php  /usr/local/php

会出现两个相关的地址 配置文件在/usr/local/php中
找到php.ini,打开之后搜索disable_functions

disable_functions = passthru,exec,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server

将shell_exec去掉,保存

undefined variable: output

[yii\base\ErrorException]
Undefined variable: output

处理这个问题有两种方式,第一种是修改codeception.yml
在settings中加上lint:false,应该是禁用的意思

settings:
    bootstrap: _bootstrap.php
    suite_class: \PHPUnit_Framework_TestSuite
    colors: true
    memory_limit: 1024M
    log: true
    lint: false 

还有一种方式就是将codeception升级到2.2以上,这个错误就不会出现了,这里我用的是第一种方式

你可能感兴趣的:(codeception,yii2,测试驱动开发,php)