Six tips for configuring PHP. ini in php _ PHP Tutorial

Source: Internet
Author: User
Tips for configuring PHP. ini in php. 1. find max_execution_time30 for the PHP script execution time. This option sets the maximum execution time of the PHP program. if a PHP script is requested, the PHP script does not exist within max_execution_time, and the PHP script execution time is found.
Max_execution_time = 30
This option sets the maximum execution time of the PHP program. if a PHP script is requested and cannot be executed within max_execution_time, PHP will not continue to run, A timeout error is returned directly to the client. If this option is not required, the default setting is 30 seconds. if your PHP script needs to be executed for a long time, you can increase the setting accordingly.

II. find the memory occupied by PHP script processing
Memory_limit = 8 M
This option specifies the maximum memory occupied by PHP script processing. the default value is 8 MB. if your server memory is more than 1 GB, this option can be set to 12 MB for faster PHP script processing efficiency.

3. disable the PHP function and find disable_functions =
This option can be used to set which PHP functions are not allowed to be used. some functions in PHP are highly risky. you can directly execute some CentOS system-level script commands. if these functions are allowed to be executed, when a PHP program has a vulnerability, the loss is very serious! The recommended function settings are as follows:
Disable_functions = phpinfo, passthru, exec, system, popen, chroot, escapeshellcmd, escapeshellarg, shell_exec, proc_open, proc_get_status
Note: If your server contains some PHP programs for CentOS system status detection, do not disable shell_exec, proc_open, proc_get_status and other functions.

IV. PHP global function declaration found
Register_globals = Off
Many articles On PHP settings On the network recommend that you set this option to On. In fact, this is an extremely dangerous setting method, which may cause serious security problems. If you do not have special requirements, we strongly recommend that you keep the default settings!

5. find the Session storage medium
Session. save_path
If your PHP program uses Session dialogs, you can set the Session storage location to/dev/shm./dev/shm is a TMPFS file system exclusive to the Linux system, the file system is mainly stored in memory, which is better than RAMDISK, because DISKSWAP can be used as a supplement and is a function module provided by CentOS system without additional configuration. Think about the speed from disk I/O operations to memory operations? Note that all data stored in/dev/shm is lost after the server is restarted. However, this is insignificant for the Session. In this way, we have completed the PHP optimization steps in the CentOS system.

6. limit on the size of PHP files to be uploaded
Upload_max_filesize = 2 M
This option sets the maximum file size that PHP can upload. the default value is 2 MB. You can increase the setting as needed.

The above mentioned hope to help PHP enthusiasts.

Optional max_execution_time = 30 this option sets the maximum execution time of the PHP program. if a PHP script is requested and the PHP script does not exist within max_execution_time...

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.