In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to optimize the CentOS system PHP, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
PHP is the abbreviation of English hypertext preprocessing language Hypertext Preprocessor. PHP is a HTML embedded language, is a server-side execution of embedded HTML document scripting language, the style of the language is similar to C language, is widely used. So, let's take a look at how to optimize PHP on CentOS systems.
PHP optimization of CentOS system
The optimization of PHP is mainly to reasonably adjust and set the relevant main parameters in php.ini. Let's take a look at how to set some parameters in php.ini that have a great impact on performance. # vi / etc/php.ini
(1) disable PHP function to find:
Disable_functions =
This option can set which PHP functions are prohibited. The risk of some functions in PHP is quite high. You can directly execute some CentOS system-level script commands. If you allow these functions to be executed, when the PHP program has vulnerabilities, the loss is very serious! Here are the recommended settings for disabling functions:
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 state detection, do not disable functions such as shell_exec,proc_open,proc_get_status.
(2) the execution time of PHP script is found:
Max_execution_time = 30
This option sets the execution time of the PHP program. If a PHP script is requested and the PHP script is not completed within the max_execution_time time, PHP no longer continues execution and returns a timeout error directly to the client. There is no special need for this option to keep the default setting for 30 seconds, and if your PHP script does require a long execution time, you can increase the time setting appropriately.
(3) PHP script deals with memory usage and finds:
Memory_limit = 8m
This option specifies the * * memory that can be consumed by PHP script processing, which defaults to 8MB. If your server memory is above 1GB, this option can be set to 12MB for faster PHP script processing efficiency.
(4) PHP global function declaration found:
Register_globals = Off
Many articles on the network about PHP settings recommend setting this option to On. In fact, this is an extremely dangerous setting method and is likely to cause serious security problems. If there is no special need, it is highly recommended to keep the default settings!
(5) find the size limit of files uploaded by PHP:
Upload_max_filesize = 2m
This option sets the size of * * uploaded files allowed by PHP. The default is 2MB. According to the actual application requirements, the setting can be increased appropriately.
(6) Session storage media found:
Session.save_path
If your PHP program uses Session dialogue, you can set the Session storage location to / dev/shm,/dev/shm is the unique TMPFS file system of the Linux system, is the memory as the main storage mode of the file system, better than RAMDISK, because you can use DISKSWAP as a supplement, and is the CentOS system comes with functional modules, do not need to be configured separately. Come to think of it, how much faster will it be from disk IO operations to memory operations? Just note that all data stored in / dev/shm will be lost after the server is restarted. But this is insignificant to Session. In this way, we have completed the steps of PHP optimization in CentOS system.
On how to optimize the CentOS system PHP to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.