In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to configure php.ini for PHP performance tuning". In daily operation, I believe many people have doubts about how to configure php.ini for PHP performance tuning. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubt of "how to configure php.ini for PHP performance tuning". Next, please follow the editor to study!
Memory
Default settin
Memory_limit = 128m
The maximum amount of memory that a single process can use, which can be set from the following points:
The type of application. If it is a memory-intensive application, you can increase this value
The average amount of memory consumed by a single PHP process, which can be calculated by running the same script multiple times
How many php-fpm processes can you afford; this value is equal to the total memory allocated divided by the average memory consumed by a single PHP process
File upload
Default settin
File_uploads = Onmax_file_uploads = 20upload_max_filesize = 2Mmax_execution_time = 30 A value of 0 means no limit
Set max_file_uploads to determine how many files are allowed to upload at the same time
Set upload_max_filesize to determine the maximum value for each file upload
If it is a long-term task, try to use the queue to handle it, so the value of max_execution_time can be shortened appropriately.
Note that the Web server can also set the file upload size and timeout, not only according to the setting of php.ini.
Conversation
PHP sessions are saved on the hard disk by default
Session.save_handler = files
In practical applications, the session should be saved in memory. You can use Memcached or Redis. This has two main benefits:
Increase the speed
It is helpful for later expansion. If the session data is stored in the hard disk, it is not convenient to add additional servers. If the session data is stored in Memcached or Redis, any distributed PHP-FPM server can access the session data.
You can install the memcached extension through PECL and set the default save_handler to memcached
Session.save_handler = 'memcached'session.save_path =' 127.0.0.1purl 11211'
Buffer output
Default value
Output_buffering = 4096
Browsers that deliver content to visitors in fewer fragments can reduce the total number of HTTP requests. Therefore, we want PHP to buffer the output. By default, PHP has output buffering enabled, and PHP buffers 4096 bytes of output before sending the content to the Web server.
Note: if you want to change the size of the output buffer, be sure to use a multiple of 4 (32-bit system) or 8 (64-bit system).
Real path caching
Default value
Realpath_cache_size = 4Mrealpath_cache_ttl = 120
PHP caches the file path used by the application, so that each time you include or import files, you do not have to constantly search for the include path. This cache is called Real path Cache (realpath cache). If you are running large PHP files (such as Composer components) and use a large number of files, increasing the size of PHP real path cache can get better performance.
At this point, the study on "how to configure php.ini for PHP performance tuning" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.