HostMonster Web Hosting Help

FastCGI for PHP

Summary

FastCGI for PHP makes all your PHP applications persistant. There is no per-request startup and initialization overhead. This makes possible the development of applications that would otherwise be impractical within the CGI paradigm (e.g. a huge PHP script or an application that requires a connection to one or more databases).

Benefits:

  • PHP scripts will run faster. The PHP interpreter is loaded into memory rather than calling from storage for every hit, having the ability to improve performance of your scripted site.
  • The load on the Server Resources can be lessened with the use of FastCGI. Since the server does not have to load the PHP interpreter for each hit, you will be able to accommodate a higher traffic site without exceeding your CPU quota. We recommend testing your site with and without FastCGI
  • No modifications to your existing code are required for most sites, however, some sites will need code modifications.

Potential Problems:

  • 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. You can Create a Ticket for further assistance.
  • There can be a few minutes 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.

How to Enable PHP FastCGI

  1. Login to your HostMonster control panel and click PHP Config.
  2. Select PHP5.4 (FastCGI)
  3. Click Save Changes.

Alternately, if you prefer to manually edit your .htaccess file:

To enable FastCGI on your account, simply add "AddHandler fcgid-script" and the extension you want into your .htaccess file.

AddHandler fcgid-script .php

PHP is already configured to work right away.

For other programming languages, you are required to use a dispatch file. (A dispatch file is a file which loads an application into memory. This is included as part of your application. There may be several dispatch files depending on what you want, such as fast-cgi.)

Note: Once you enable fastcgi, your site will only use HostMonster's php.ini settings. If you have a custom php.ini file, it will not be used.

Knowledgebase Article 149,429 views bookmark tags: acceleration fastcgi php scripting (updated 259 days ago)


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

This article explains how to enable FastCGI for PHP applications. (updated 440 days ago)
Knowledgebase Article 58,749 views tags: fastcgi php

How do I enable PHP 5 for my PHP applications? How do I change to PHP FastCGI? How do I use a single php.ini file? (updated 229 days ago)
Knowledgebase Article 129,464 views tags: config php

PHP vs PHP single php.ini vs PHP with FastCGI (updated 703 days ago)
Knowledgebase Article 109,240 views tags: configuration php server

Related Help Content

Policy Regarding: Scripting, Coding, & Third Party Product Issues (PHP/Perl/RoR/etc.) (updated 1258 days ago)
Knowledgebase Article 68,266 views tags: code script scripting

How do I change the PHP environment for my site with php.ini? (updated 259 days ago)
Knowledgebase Article 254,617 views tags: configuration php server

How do I turn the display_errors flag on for php? (updated 1641 days ago)
Knowledgebase Article 67,219 views tags: display errors php

In the newer versions of PHP, they have included a new directive to control and handle remote includes. We disable this option, by default, which may affect some of your PHP scripts. (updated 1623 days ago)
Knowledgebase Article 50,675 views tags: php remote url

This article will outline which PHP PEAR Packages are installed and how you can install additional PHP PEAR Packages. (updated 190 days ago)
Knowledgebase Article 52,788 views tags: package pear php

When creating a symlink to a php page, I get a 500 error. I am able to use symlinks to other files and folders fine. (updated 1413 days ago)
Knowledgebase Article 46,829 views tags: link php

How can I adjust the php settings specifically for an Addon Domain? (updated 641 days ago)
Knowledgebase Article 88,364 views tags: domain php

Using PHP on HostMonster.com (updated 1643 days ago)
Knowledgebase Article 63,790 views tags: php