Locate the PHP configuration file and view the configuration file path command:/usr/local/php/bin/php-i |head
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
Use the command to view forbidden functions:/usr/local/php/bin/php-i |grep Disable_f
A warning appears, here we configure the time zone: date.timezone= ' asia/chongqing '
2. Configure Error_log
Open PHP.ini, find the following options to configure
Display_errors=off
Log_errors=on
Error_log=/path/to/logfile
error_reporting = E_all & ~e_notice
Error level Reference
; 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
3. Configure Open_basedir
Global configuration: Php.ini:open_basedir =/dir1/:/dir2
For virtual machine configuration: Httpd-vhost.conf:php_admin_value open_basedir "/dir1/:/dir2/"
4. Installing the PHP extension (memcache)
memcache compiling in PHP
# wgetHttp://www.lishiming.net/data/attachment/forum/memcache-2.2.3.tgz
# tar zxvf memcache-2.2.3.tgz
# CD memcache-2.2.3
#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config
# make
# make install
# CP modules/memcache.so/usr/local/php/ext///copy memcache.so to PHP extension_dir, #查看php Extension_dir method is/usr/ Local/php/bin/php-i |grep Extension_dir
Modify the extension path and modify it in php.ini:
Extension_dir = "/usr/local/php/ext"
then add the php.ini in the
Extension = memcache.so
after saving, you can use/USR/LOCAL/PHP/BIN/PHP-M to detect and view specific parameters.
memcached Compilation and Installation
wgetHttp://syslab.comsenz.com/downloads/linux/memcached-1.4.5.tar.gz
Tar zxvf memcached-1.2.8.tar.gz
CD memcached-1.2.8
./configure--prefix=/usr/local/memcached
Make && make install
Start:
/usr/local/memcached/bin/memcached-m 2048-p 11211-l 127.0.0.1-d-u www
-M behind specifies how much memory memecached uses, in units of M
- p Specify memcached boot port
-l Specifies the IP of the binding
-u Specifies to start as an account
。。。
Basic PHP Configuration