Use FastCGI for PHP and make you website run faster

Last time when I logged into Control Panel of my account at Hostmonster, I realized that there is one menu section that I never entered before. Name of this section is FastCGI Acceleration.

I was intrigued by this name and clicked on this link. What I’ve seen there was this explanation:

FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_phpsusexec. This eliminates the overhead of loading the PHP interpreter on every hit. Since it is always in memory ready for the next hit, the responses will be generated faster. NO MODIFICATIONS to your existing PHP applications will be performed so you can easily enable and disable it at will.

When I digged deeper into this I was able to find more information on this subject. FastCGI applications are fast because they're persistent. There is no per-request startup and initialization overhead. This makes possible the development of applications which would otherwise be impractical within the CGI paradigm (e.g. a huge PHP script, or an application which requires a connection to one or more databases).

Benefits of FastCGI are :

  • PHP scripts will run faster. The PHP interpreter is loaded into memory rather than calling from storage for every hit, greatly improving performance of your scripted site.
  • You will use less Server Resources. Since the server does not have load the PHP interpreter for each hit, you will be able to accommodate a higher traffic site without exceeding your CPU quota.
  • NO modifications to your existing code are required. Everything you currently run will work with FastCGI for PHP.

However there are some potential problems, that could be associated with FastCGI Acceleration for PHP:

  • You will only have one php.ini file available for all subdirectories (/home/USERNAME/public_html/php.ini). This is necessary to help optimize the website code as much as possible. If you need multiple php.ini files to accommodate different scripting needs, you can disable FastCGI for PHP on any of your subdirectories while leaving the rest of the account enabled for performance.
  • There can be a few minute delay in any updates you make to your PHP environment (ie, php.ini changes). Since your php.ini is loaded into memory for greater speed, every hit does not re-read it from storage.

I enabled FastCGI for PHP on my account with Hostmonster and realised that my sites started to load much faster. I was not measuring actual speed but just visually everything started to work faster. Not only Joomla but some other scripts that were giving very heavy server load.

Add New Search
Write comment
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."


We Are Hosted By

website tracker website tracker