Home >Backend Development >PHP Tutorial >lamp/lnmp optimization 3--phpini

lamp/lnmp optimization 3--phpini

WBOY
WBOYOriginal
2016-07-29 09:02:521067browse

This chapter talks about the optimization of PHP engine.

1.php cache acceleration, please refer to the previous article.

2. Use tmpfs as the cache acceleration file directory

3.php.ini parameter tuning

3.1 Turn on php safe mode

Method: safe_mode=on

3.2 User group security

Method: safe_mode_gid=off

3.3 Turn off dangerous functions, take disabling system functions as an example

Method: disable_functi/p>

3.4 Turn off the leakage of PHP version information in the http header

Method: expose_php=off

3.5 Turn off registered global variables

Method: register_globals =off

3.6 Turn on magic_quotes_gpc to prevent sql injection

Method: magic_quotes_gpc=on

3.7 Error message control

Method: display_error=off

3.8 Optimize some resource limit parameters

3.8.1 Set the maximum running time of the script

Method: max_excuti/p>

3.8.2 Use maximum memory per script

Method: memory_limit=128M

3.8.3 Maximum time each script waits for input

Method: max_input_time=30

3.8.4 Upload files Maximum allowed size

Method: upload_max_filesize=2M

3.9 Prohibit opening remote address

Method: allow_url_fopen=off cgi.fix_pathinfo=0

3.10php session parameter adjustment

Method: session.save_handler=files Session handler name, The default is file, optional memcache, etc. session.save_path=''/tmp'The default session is stored in tmp. If you use another processor, please specify the path

eg.session.save_handler=memcache session.save_path=''tcp: //10.0.0.1:11211"

The above has introduced lamp/lnmp optimization 3--phpini, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP first certificationNext article:PHP first certification