/usr/local/php/bin/php -i|grep -i "loaded configuration file"
Loaded Configuration File => /usr/local/php/etc/php.ini
没有php.ini 那么就需要复制模板过来
cd /usr/local/src/php-5.6.30/
cp php.ini-development /usr/local/php/etc/php.ini
vim /usr/local/php/etc/php.ini
vim /usr/local/php/etc/php.ini
搜索disable_functions
在disable_functions =后面添加函数
eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close
disable_functions = eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close,phpinfo
/usr/local/apache2.4/bin/apachectl -t
/usr/local/apache2.4/bin/apachectl graceful
禁用函数后,这些函数就无法被调用,例如phpinfo作用是显示php的配置,而禁用后使用网页无法显示出来;
搜索date.timezone
修改date.timezone =为
date.timezone = Asia/Shanghai
搜索display_errors
将display_errors = On改为
display_errors = Off
搜索error_log =
修改error_log = 目录为
error_log = /tmp/php_errors.log
搜索error_reporting =
在error_reporting = E_ALL 修改为
error_reporting = E_ALL & ~E_NOTICE
open_basedir的作用是限制php在指定的目录里活动
vim /usr/local/php/etc/php.ini
搜索error_log =修改为指定目录
open_basedir = /data/wwwroot/111.com:/tmp推荐在虚拟配置中设置
vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
针对网站站点增加代码
php_admin_value open_basedir "/data/wwwroot/111.com:/tmp/"
原文地址:http://blog.51cto.com/shuzonglu/2083970