Resolving the fast CGI Issues


In case you have enabled PHP to run as fastCGI on your Dedicated Server, this article may assist you to rectify some usual issues.

 


One-Time Configuration Changes

Few of the usual issues can be rectified with one-time configuration changes. Give below are the troubleshooting steps for few of these:

 

Session issues

In case if you have enabled FastCGI for first time, you may find some session related errors with websites that make use of PHH sessions, for example websites running Joomla, Wordpress, Magento etc.. To fix these kind of issues, you have to allot a new session.save_pth or just run the following command via SSH as root to modify the authorizations of the default session storage path:

 

Command: chmod 1777 /var/lib/php/session


HTTP error at the time of uploading files

If you are facing any http error at the time of uploading files bigger than 128KB (Kilobytes), you need to edit your FastCGI configuration file and make greater in size, which default to 128KB. To increase the limit to 1GB, follow the below steps:

 

  • Alter the fastCGI configuration file, available at:

  • /etc/httpd/conf.d/fcgid.conf

  • Add the line mentioned below to your configuration file:

  • FcgidMaxRequestLen 1073741824

  • Than restart your Apache server with the following command:

  • service httpd restart


503 HTTP Errors

If you are facing 503 http errors on your websites that utilize fastCGI and running on Plesk panel, there is a simple solution to fix this error:

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

The above command will rectify any wrong ownership authorizations on the /var/run/mod_fcgid/sock folder, which can occasionally result in 503 errors on your websites.

Changes Needed Per Sites

Few FastCGI concerns may need that modifications be done on per site basis, making use of the PHP/fastCGI configuration for every domain name hosted on dedicated server. Given below are few common issues that may need a site-by-site.

Here are some common issues that may require a domain-by-domain reach:

 

Permission Related Issues

If you website or application was running for a period of time before configuring FastCGI, you may get few files as well as folder owned by Apache web server, which your new FastCGI configuration will not be having the power to make changes in it. In order to fix this you will require to accurately assign permissions.

 

Important- You will require to modify the yourdomain.com and domainuser text in the example given below with your correct FTP username for this domain name::

 

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

 

PHP Directives & Timezone

Beginning with Plesk’s 10.3 version, each and every website now has an unique .ni configuration file, which manages by Plesk. To perform custom PHP settings alterations, you need to modify conf/php.ini file and then tell Plesk to revive etc/php.ini file. To give an example domain yourdomain.com, the complete path to this file is:

 

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

Here is a good piece from a default conf/php.ini file which is going to set a timezone:

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

 

Once you have done with the creation process of the conf/php.ini file, you should inform Plesk panel to revive the php.ini configuration. Follow the given steps to perform this:

 

  • Go to the Domain’s control panel.

  • Hit “Websites & Domains’ section.

  • Hit the name of this domain name.

  • From the drop-down of PHP support/Run PHP, choose something other that FastCGI, then hit OK button to save.

  • Set this value back to FastCGI and hit OK button to save one more time.