
MAMP 3 is by far the best option for running a local web server with easy access to PHP, MySQL, and a range of dynamic DNS options.
MAMP 3 is by far the best option for running a local web server with easy access to PHP, MySQL, and a range of dynamic DNS options.
The moment I upgraded to PHP 5.4, my Wordpress sites and servers were flooded with error messages. Thankfully, the crew at Atomicorp are maintaining a legacy PHP 5.3 repository that you can use to easily downgrade your PHP installation. This guide will show you how to use the Nucleus repository to safely and easily downgrade your PHP version back to 5.3.
APC is an opcode cache that can significantly speed up your PHP applications. When dealing with Plesk web servers with multiple users and websites, APC PHP cache might be required in order to achieve reliable server performance.
Tuning Plesk servers for optimal Apache PHP / FCGI performance can be a nightmare. Here is a great guide on getting you started. Special thanks to the LinuxDriver blog for some of these great tips.
This should go without saying: make sure to backup your configuration files before trying any new settings!
1 |
nano /etc/httpd/conf.d/fcgid.conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
LoadModule fcgid_module modules/mod_fcgid.so AddHandler fcgid-script fcg fcgi fpl FcgidIPCDir /var/run/mod_fcgid/sock FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm FcgidInitialEnv RAILS_ENV production FcgidIdleTimeout 3600 FcgidIdleScanInterval 480 FcgidBusyTimeout 1800 FcgidBusyScanInterval 480 FcgidZombieScanInterval 12 FcgidErrorScanInterval 12 FcgidProcessLifeTime 0 # Change the rate at which new FastCGI processes are spawned under load. Higher=faster FcgidSpawnScoreUpLimit 10 # Higher number = spawning more FastCGI processes decreases the spawn rate (controls runaway FcgidSpawnScore 1 # Higher number = terminating FastCGI processes decreases the spawn rate (controls runaway) FcgidTerminationScore 2 # Increase the FastCGI max request length for large file uploads (needed for some sites) FcgidMaxRequestLen 1073741824 FcgidMaxRequestsPerProcess 100000 #FcgidMinProcessesPerClass 3 FcgidMaxProcessesPerClass 4 FcgidMaxProcesses 16 FcgidIOTimeout 1800 |
Next, let's edit our php.conf
1 |
nano /etc/httpd/conf.d/php.conf |
1 2 3 |
AddHandler php-script .php AddType text/html .php DirectoryIndex index.php |
Now we are going to create a special SWTune.conf configuration file. I've had mixed success with this, so please experiment with this. I believe this will be more effective on lower resource systems. You may choose to skip this step.
1 |
nano /etc/httpd/conf.d/swtune.conf |
1 2 3 4 5 6 7 8 9 10 11 12 |
HostnameLookups off KeepAlive Off StartServers 1 ServerLimit 2 MinSpareThreads 32 MaxSpareThreads 96 ThreadLimit 64 ThreadsPerChild 32 ThreadStackSize 2097152 MaxClients 64 MaxRequestsPerChild 0 |
Finally, this next shell command will determine the best configuration settings based on your processors and amount of memory.
1 2 3 4 5 6 7 |
num_cpus=$(awk '/^processor/{count++}END{print count}' /proc/cpuinfo) sed -i 's%[#]*HTTPD=.*%HTTPD=/usr/sbin/httpd.worker%g' /etc/sysconfig/httpd sed -i 's%HTTPD_BINs.*%HTTPD_BIN /usr/sbin/httpd.worker%g' /etc/psa/psa.conf sed -i "s/(ServerLimits*).*/1$(( $num_cpus * 2 ))/" /etc/httpd/conf.d/swtune.conf sed -i "s/(MaxClientss*).*/1$(( ( $num_cpus * 2 ) * 32 ))/" /etc/httpd/conf.d/swtune.conf service psa stopall service psa restart |
Notes:- The earlier mentioned sequences or patterns will adapt the host limitations and Optimum Customers in respect to the CPU quantity.
I spent some time trying to figure out how to fix the Suexec Policy Violation error under Plesk in Centos.