-
- # 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
Copy code
# End of autogenerated PHP configuration.
After saving, restart apache.
4. Since a large number of php processes occupy memory for a long time, you can clear the php processes once an hour.
crontab -e
Move the cursor to the bottom
0 * * * * ps aux | grep php | egrep -v grep | awk ‘{print $2}’ | xargs kill -9
Ctrl+O to save, Enter, Ctrl+X to exit
For step 3, some foreigners have also summarized other methods:
Log in to WHM->Apache Configuration->Include Editor->Pre Virtual host Include
Special attention is paid to:
- 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!)
-
-
- ThreadStackSize 4000000
- ServerLimit 2
- StartServers 1
- MaxClients 128
- MinSpareThreads 1
- MaxSp areThreads 1
- ThreadsPerChild 8
- MaxRequestsPerChild 700
- TimeOut 45
- < ;/p>
- 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
-
Copy code
|