How to resolve the fast CGI?

If you have enabled the PHP to run as FastCGI on the Server, this article will help you in some of the common issues.


How to resolve the fast CGI?

Some of the most common FastCGI issues can be resolved with the help of one-time configuration changes. Here are some of the troubleshooting instruction discussed below:

 

If it is the first time that you have enabled the FastCGI, you might be able to see some of the session errors with the websites that are using php sessions like the websites running Drupal, Joomla etc. For correcting these issues you will have to assign a new session.save_path or you just need to simply run this command. For altering the permissions of the default session storage path:

chmod 1777 /var/lib/php/session

HTTP errors when uploading the files

If you are experiencing an ‘http error’ when uploading the files which are larger than 128kb, then you will have to edit the FastCGI configuration file and then increase the limit, which defaults to this low value. For setting up the limit to 1GB you will have to follow the instructions shown below:

  • Editing the FastCGI configuration file which is located at
  • /etc/httpd/conf.d/fcgid.conf
  • Now you need to add this line to your configuration file which is just below all the other lines which are starting with ‘Fcgid’
  • FcgidMaxRequestLen 1073741824
  • Now you need to restart the Apache web-server service with the following command:
  • service httpd restart

If you are encountering 503 errors on the website which is using FastCGI, and that are using FastCGI, and are running Plesk 10.3.1, then it can be fixed very easily:


chown apache:apache /var/run/mod_fcgid/sock && service httpd restart

This will be able to correct any type of incorrect ownership permissions that are in the var/run/mod_fcgid/sock file which sometimes result in the 503 errors.

Some of the FastCGI issues might require that changes should be made on per website basis, by using the PHP/FastCGI configuration for each domain. Here we will discuss some of the common issues that would require a domain-by-domain approach:

If the website was running for a while before the configuration of FastCGI, then you might be having some files or the folders which are being owned by the ‘apache’, which the FastCGI configuration will not be able to modify. For resolving this you will properly have to set the ownership as well as permissions.

In the below-mentioned text you will have to replace the example.com and domainuser text with the actual FTP username for the domain name:

cd /var/www/vhosts/example.com httpdocs && chown -R domainuser:psacln * && find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;

You might also need to adjust ‘httpdocs’ in the above-mentioned example if this is not the path that has been assigned to the domain name within the Plesk.

Starting with the Plesk 10.3, each of the websites now is having a unique php.in configuration, which Plesk is managing. For making the custom PHP settings modification you will have to edit 'conf/php.ini' and then tell the Plesk for regenerating ‘etc/php.ini’. For the domain name example.com, the full path to the file is:

/var/www/vhosts/help/example.com/etc/php.ini


[PHP]
date.timezone = 'India/New_Delhi'/


Once after the creation of 'conf/php.ini' file, one must be telling the Plesk for regenerating the php.ini configuration. For doing so:

  • Navigation to the domains control panel
  • Clicking on the ‘Websites & Domains’.
  • Now you need to click on the name for this domain.
  • Now in the ‘PHP support’/’Run PHP as’ drop-down, now you need to select something other than the FastCGI, then you need to click ‘OK’ for saving it.
  • Setting this value back to the FastCGI, and then clicking ‘OK’ for saving it once more.