jquery教程

推荐列表 站点导航

当前位置:首页 > jquery > jquery教程 >

cpanel中的php运行方式使用fast-cgi模式的配置方法

来源:网络整理  作者:网友投稿  发布时间:2020-12-27 17:05
fast-cgi模式会比suphp模式消耗较多一些的内存,如果内存不多,不建议使用。如果cpu不够强,且经常高负,但内存却充...

注:
1)、fast-cgi省cpu耗内存难监控。
2)、suphp省内存耗cpu易监控。

1.php要使用fast-cgi,首先在EasyApache编译的时候,要选上cgi-fcgi模块。如果之前没有编译可以重新EasyApache编译。

2.WHM >> Service Configuration >> Configure PHP and SuExec
PHP 5 Handler 选择 fcgi
“Save New Configuration”

3.php换成fast-cgi之后,编辑php.conf
nano -w /etc/httpd/conf/php.conf
 

复制代码 代码如下:

# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 15
MaxRequestLen 15728640
ProcessLifeTime 120
IdleTimeout 30
DefaultMinClassProcessCount 0
DefaultMaxClassProcessCount 3
IPCConnectTimeout 60
IPCCommTimeout 30
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml

# End of autogenerated PHP configuration.

保存好之后,重启apache。

4.由于大量php进程长期占用内存,可以每小时执行一次清空php进程。
crontab -e
把光标弄到最下
0 * * * * ps aux | grep php | egrep -v grep | awk ‘{print $2}’ | xargs kill -9
Ctrl+O保存,Enter,Ctrl+X退出

对于第3步,也另有老外总结出其它方法:
登录 WHM->Apache Configuration->Include Editor->Pre Virtual host Include

特别关注地是:
- DefaultMinClassProcessCount 0 (necessary to make Idle timeout work)
- ThreadStackSize (default is too high, wastes memory, the setting below is good for most and will save enough memory to allow another php thread!)
 

复制代码 代码如下:

<IfModule mpm_worker_module>
ThreadStackSize 4000000
ServerLimit 2
StartServers 1
MaxClients 128
MinSpareThreads 1
MaxSpareThreads 1
ThreadsPerChild 8
MaxRequestsPerChild 700
TimeOut 45
</IfModule>

<IfModule mod_fcgid.c>
MaxRequestsPerProcess 500
MaxProcessCount 15
DefaultMaxClassProcessCount 15
DefaultMinClassProcessCount 0
IPCConnectTimeout 60
IPCCommTimeout 3
PHP_Fix_Pathinfo_Enable 1
IdleTimeout 30
IdleScanInterval 10
BusyTimeout 120
BusyScanInterval 90
ErrorScanInterval 60
ZombieScanInterval 3
ProcessLifeTime 120
</IfModule>

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jq/jc/9766.shtml

相关文章
最新文章
PHP识别相片是否是颠倒的 PHP识别相片是否是颠倒的

时间:2020-12-28

python编程有哪些ide python编程有哪些ide

时间:2020-12-28

python开发工程师是做什么 python开发工程师是做什么

时间:2020-12-28

php构造函数的作用 php构造函数的作用

时间:2020-12-28

php怎么跟数据库连接 php怎么跟数据库连接

时间:2020-12-28

php实现顺序线性表 php实现顺序线性表

时间:2020-12-28

Python多重继承中的菱形继 Python多重继承中的菱形继

时间:2020-12-28

php中break的作用 php中break的作用

时间:2020-12-28

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

cpanel中的php运行方式使用fast-cgi模式的配置方法

2020-12-27 编辑:网友投稿

注:
1)、fast-cgi省cpu耗内存难监控。
2)、suphp省内存耗cpu易监控。

1.php要使用fast-cgi,首先在EasyApache编译的时候,要选上cgi-fcgi模块。如果之前没有编译可以重新EasyApache编译。

2.WHM >> Service Configuration >> Configure PHP and SuExec
PHP 5 Handler 选择 fcgi
“Save New Configuration”

3.php换成fast-cgi之后,编辑php.conf
nano -w /etc/httpd/conf/php.conf
 

复制代码 代码如下:

# Fastcgi configuration for PHP5
LoadModule fcgid_module modules/mod_fcgid.so
MaxRequestsPerProcess 15
MaxRequestLen 15728640
ProcessLifeTime 120
IdleTimeout 30
DefaultMinClassProcessCount 0
DefaultMaxClassProcessCount 3
IPCConnectTimeout 60
IPCCommTimeout 30
AddHandler fcgid-script .php5 .php4 .php .php3 .php2 .phtml
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php3
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php2
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .phtml

# End of autogenerated PHP configuration.

保存好之后,重启apache。

4.由于大量php进程长期占用内存,可以每小时执行一次清空php进程。
crontab -e
把光标弄到最下
0 * * * * ps aux | grep php | egrep -v grep | awk ‘{print $2}’ | xargs kill -9
Ctrl+O保存,Enter,Ctrl+X退出

对于第3步,也另有老外总结出其它方法:
登录 WHM->Apache Configuration->Include Editor->Pre Virtual host Include

特别关注地是:
- DefaultMinClassProcessCount 0 (necessary to make Idle timeout work)
- ThreadStackSize (default is too high, wastes memory, the setting below is good for most and will save enough memory to allow another php thread!)
 

复制代码 代码如下:

<IfModule mpm_worker_module>
ThreadStackSize 4000000
ServerLimit 2
StartServers 1
MaxClients 128
MinSpareThreads 1
MaxSpareThreads 1
ThreadsPerChild 8
MaxRequestsPerChild 700
TimeOut 45
</IfModule>

<IfModule mod_fcgid.c>
MaxRequestsPerProcess 500
MaxProcessCount 15
DefaultMaxClassProcessCount 15
DefaultMinClassProcessCount 0
IPCConnectTimeout 60
IPCCommTimeout 3
PHP_Fix_Pathinfo_Enable 1
IdleTimeout 30
IdleScanInterval 10
BusyTimeout 120
BusyScanInterval 90
ErrorScanInterval 60
ZombieScanInterval 3
ProcessLifeTime 120
</IfModule>

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jq/jc/9766.shtml

相关文章

风云图片

推荐阅读

返回jquery教程频道首页