PHP-FPM on highload tips

本文提供了一系列优化高负载网站使用PHP-FPM的FastCGI的建议,包括模块编译、增加子进程数量、使用SOCKET、提高最大打开文件数限制、设置PHP-FPM的open file description限制以及使用代码加速器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

When you running a highload website with PHP-FPM via FastCGI, the 
following tips may be useful to you : ) 

1. Compile PHP's modules as less as possible, the simple the best 
(fast); 

2. Increas PHP FastCGI child number to 100 and even more. Sometime, 
200 is OK! ( On 4GB memory server); 

3. Using SOCKET PHP FastCGI, and put into /dev/shm on Linux; 

4. Increase Linux "max open files", using the following command (must 
be root): 
    # echo 'ulimit -HSn 65536' >> /etc/profile 
    # echo 'ulimit -HSn 65536 >> /etc/rc.local 
    # source /etc/profile 

5. Increase PHP-FPM open file description rlimit: 
    # vi /path/to/php-fpm.conf 
    Find "<value name="rlimit_files">1024</value>" 
    Change 1024 to 4096 or higher number. 
    Restart PHP-FPM. 

6. Using PHP code accelerator, e.g eAccelerator, XCache. And set 
"cache_dir" to /dev/shm on Linux.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值