Basic php configuration

Source: Internet
Author: User
For basic php configuration, find the php configuration file and view the path of the configuration file. Command:/usr/local/php/bin/php-I | head

1. configure disable_function

Disable_functions = eval, assert, popen, passthru, primary, primary, passthru, exec, system, chroot, scandir, chgrp, chown, primary, primary, shell_exec, proc_get_status, ini_alter, primary, dl, pfsockopen, openlog, syslog, readlink, symlink, leak, popepassthru, stream_socket_server, popen, proc_open, proc_close

Run the following command to view the prohibited functions:/usr/local/php/bin/php-I | grep disable_f

If a warning is displayed, configure the time zone: date. timezone = 'Asia/Chongqing'


2. configure error_log

Open php. ini and find the following options for configuration.

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 fatal error. The execution of the script is paused.
; E_RECOVERABLE_ERROR most fatal errors.
; E_WARNING non-fatal runtime error, only warning, script execution will not stop.
; E_PARSE parsing error during compilation. parsing error should only be generated by the analyzer.
The reminder generated when the E_NOTICE script is running (usually some bugs in the script we wrote, for example, a variable is not defined). This error will not cause task interruption.
The reminder information generated when the E_STRICT script is running will contain some suggestions that php throws for us to modify.
; E_CORE_ERROR fatal error after php is started
_ Core_warning non-fatal error after php is started, that is, warning information
; E_COMPILE_ERROR fatal errors generated during php compilation
; E_COMPILE_WARNING warning information generated during php compilation
; E_USER_ERROR error generated by the user
; E_USER_WARNING user-generated warning
; E_USER_NOTICE user-generated reminder



3. configure open_basedir

Global configuration: php. ini: open_basedir =/dir1/:/dir2

For virtual machines: httpd-vhost.conf: php_admin_value open_basedir "/dir1/:/dir2 /"


4. install the php Extension Module (memcache)

Compile memcache in php
# Wget http://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 // put memcache. copy so to the extension_dir directory of php. # The method for viewing php extension_dir is/usr/local/php/bin/php-I | grep extension_dir.
Modify the extension path in php. ini:
Extension_dir = "/usr/local/php/ext"
Then add
Extension = memcache. so

After saving, you can use/usr/local/php/bin/php-m to detect and view specific parameters.


Compile and install memcached
Wget http://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: specifies the memory used by memecached. the unit is M.
-P specifies the memcached startup Port
-L specify the bound IP address
-U indicates to start as an account


...

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.