今天将程序移植到远程服务器中出现很多异常的错误,本地没有任何错误,到服务器之后出现各种问题。现将首次遇到的问题进行总结后期将不断对此进行更新
1.php Yii: 出现undefined offset 或者 undefined index解决方案
解决方式: 修改php.ini中配置,没有则增加
log_errors = On
error_log = "/usr/local/lnmp/php/var/log/error_log"
error_reporting=E_ALL&~E_NOTICE
记得要重启Apache/ngnix哦
2.无法使用exec()函数 Warning: exec() has been disabled for security reasons in
exec()函数无法使用
程序报错:Warning: exec() has been disabled for security reasons in
原因:在php.ini中存在 disable_functions配置,默认配置中,cli执行函数都是被 禁止的,如果需要的话,需要在php.ini中将 disable_functions = exec , popen, system …. ,将你需要执行的函数从列表中删掉在重启apache即可 。
完全是配置的问题。
php-apache2handler.ini
php.ini
disable_functions = proc_open, popen, exec, system, shell_exec, passthru