PHP Related configuration View PHP configuration file location
/usr/local/php/bin/php -i|grep -i "loaded configuration file"
Loaded Configuration File => /usr/local/php/etc/php.ini
Without php.ini, then you need to copy the template.
cd /usr/local/src/php-5.6.30/cp php.ini-development /usr/local/php/etc/php.ini
Edit PHP configuration file
vim /usr/local/php/etc/php.ini
Prohibition of dangerous functions
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
Preview
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
Effective configuration
/usr/local/apache2.4/bin/apachectl -t/usr/local/apache2.4/bin/apachectl graceful
Effect:
After disabling the function, these functions cannot be called, for example, Phpinfo function is to display the configuration of PHP, and the use of Web pages can not be displayed after disabling;
Defining time zones
Search Date.timezone
Modify Date.timezone = To
Date.timezone = Asia/shanghai
Turn off error message display
Search Display_errors
Change display_errors = on to
Display_errors = Off
Defining error logs
Search Error_log =
Modify Error_log = Directory to
Error_log =/tmp/php_errors.log
Defining error log levels
Search error_reporting =
In error_reporting = E_all revision changed to
error_reporting = E_all & ~e_notice
Open_basedir parameter setting
Open_basedir's role is to limit PHP activity in the specified directory.
Vim/usr/local/php/etc/php.ini
Search Error_log = Modify to the specified directory
Open_basedir =/data/wwwroot/111.com:/tmp
Recommended settings in Virtual configuration
Vim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf
Add code for Site site
Php_admin_value Open_basedir "/data/wwwroot/111.com:/tmp/"
Lamp architecture-php Related configuration