Lamp Architecture-php Related configuration

Source: Internet
Author: User
Tags time zones openlog phpinfo symlink syslog

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.