LAMP---PHP configuration

Source: Internet
Author: User
Tags php error php error log

Note: Open_basedir


configuration file /usr/local/php/etc/php.ini


one. PHP configuration
1. Configure Disable_function
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

2. Configure Error_log
Display_errors=off
whether to display the error (browser) (browser white page can be used, modified to change back)
we recommend using the error log
Log_errors=on
error_log=/usr/local/php/logs/php_errors.log error Log


Cd/usr/local/php/logs

Touch Php_errors.log

chmod 777 Php_errors.log



Configuration error log level (kind)
error_reporting = E_all & ~e_deprecated commented out

error_reporting = e_all & ~e_notice Add

vim/data/www/forum.php PHP code files, verifying the use of

CURL-XLOCALHOST:80 Http://www.222.com/forum.php-I See the type of error

3. Configure Open_basedir (one site is under attack, the other site is not affected)
PHP.ini: Found Open_basedir is not enabled by default

Open_basedir =/dir1/:/dir2

It is recommended to write the following method (each site is written separately, to each site to specify a directory, the site is active in this directory)
Apache Http:vhost:

</VirtualHost> Add above

Php_admin_value Open_basedir "/data/www:/tmp/"

Use on two websites or more


Using curl-xlocalhost:80 111.com-i

View error message, 500 error website program error


[12-jan-2015 23:41:25 america/new_york] PHP Fatal error:Unknown:Failed opening required '/data/www/index.php ' (incl Ude_path= '.:/ usr/local/php/lib/php ') in Unknown on line 0
Reporting such errors is caused by a open_basedir problem


/usr/local/php/bin/php-i |grep-i open_basedir View Open_basedir file pointing to

/usr/local/php/bin/php-i |head-15



PHP error Log level Error_report

; E_all all errors and warnings (except e_strict)

; E_error a fatal error. Execution of the script is paused.

; E_recoverable_error most of the fatal errors.

; E_warning a non-fatal run-time error, just a warning, the execution of the script does not stop.

; E_parse compile-time parsing errors, parsing errors should only be generated by the parser.

; E_notice the reminders that are generated when the script runs (often some bugs in the script we write, such as a variable that is not defined), will not cause the task to break.

; The reminder message generated when the E_strict script runs contains some suggestions that PHP throws to let us modify.

; E_core_error fatal error occurred after PHP startup

; E_core_warning a non-fatal error that occurs after PHP is started, which is a warning message

; E_compile_error fatal errors generated by PHP compilation

; E_compile_warning warning Messages generated by PHP compilation

; E_user_error user-generated errors

; E_user_warning user-generated warnings

; E_user_notice User-generated reminders


This article is from the "you and I Walk" blog, please be sure to keep this source http://ondali.blog.51cto.com/6650368/1611694

LAMP---PHP 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.