As default, 34SP.com hosting servers run PHP as an Apache module (mod_php).  PHP as an Apache module works fine for the majority of PHP scripts.  Some scripts however will not run under this standard installation, due to settings such as safe mode or file permissions. 

In many cases, scripts just need permission to create or update files. Most scripts, such as WordPress will run well using our new mod_ruid script. This is less heavy on your sites resources and should be used before considering pour phpcgi installers.

mod_ruid and phpcgi can be installed within your control panel. Simply click on 'One Click Installers' and choose the installer you wish to use.


Our "phpcgi" installations can be used to counter any restrictions you find in the standard PHP installation.

The main benefit for most users is that phpcgi allows you to run PHP scripts without the safe mode restrictions.  phpcgi retains the majority of functionality from the mod_php installation but also adds new features such as Aspell, Calendar library and the mysqli functions.  On request we can also compile custom binaries to include additional features and functions.  

We have two versions of phpcgi available - these are as "phpcgi" and "phpfastcgi".  Both take only a few MB of diskspace to install on your account. 


So what is the difference between phpcgi and phpfastcgi?

phpcgi is loaded on every call to the webpage. If your site is not a very busy site then this version is the best option.

phpfastcgi is loaded and retained in memory. This has the advantages of a slightly faster load time.  The only drawback is that that you may find the script caches in memory until the process dies out.  We recommend you develop under phpcgi and switch to phpfastcgi at a later date if needed.


Installing php-cgi

Our automatic phpcgi installer can be found here: https://installers.34sp.com/phpfastcgi/

Once you have run the installer, you can confirm phpcgi is correctly installed via: http://www.YOURDOMAIN/testphpcgi 

This page will display a phpinfo() output, this should list CGI in the server API field.  If you do not see this, please contact 34SP.com support.

To make a specific directory (in our example: testphpcgi) run under phpcgi requires the the .htaccess file be copied to the directory in question.  If you wish to use phpcgi for the whole site, you should place the .htaccess file in your httpdocs directory.

If you cannot see the .htaccess file in the testphpcgi folder, check your FTP client settings.  Look for an option similar to "show hidden files" and enable it.


Installing php-fast-cgi

This installer can be found here: https://installers.34sp.com/phpfastcgi/

Once you have run the installer, you can confirm phpcgi is correctly installed via: http://www.YOURDOMAIN/testphpfcgi

This page will display a phpinfo() output, this should list FastCGI in the Server API field.  If you do not see this, please contact 34SP.com support.

To make a specific directory (in our example: testphpcgi) run under phpcgi requires the the .htaccess file be copied the directory in question.  If you wish to use phpcgi for the whole site, you should place the .htaccess file in your httpdocs directory.

If you cannot see the .htaccess file in the testphpcgi folder, check your FTP client settings.  Look for an option similar to "show hidden files" and enable it.


Custom PHPCGI Binaries

If you would like access to something that is not listed in the phpcgi outputs we may be able to create a custom CGI for you. Please email us with details of the modules you would like access to.  Extra modules will increase the disk space needed by the phpcgi installation.

Please note: you should fully close down your browser and reopen it after installing php(fast)cgi, otherwise you may cause session errors due to the change of php version.

Article ID: 178, Created On: 6/30/2009, Modified: 9/14/2011