Follow

Resolve FastCGI Issues

  • Applies to: All DV
    • Difficulty: Medium
    • Time Needed: 30 minutes
    • Tools Required: SSH access

Overview

If you have enabled PHP to run as FastCGI on your DV server 4.0 or VPS server, this article may help you resolve some common issues.

READ ME FIRST
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is generally unsupported by (mt) Media Temple. Please take a moment to review the Statement of Support.

One-Time Configuration Changes

Some common FastCGI issues can be resolved with one-time configuration changes. Below are troubleshooting instructions for some of these:

Session issues

If this is the first time you've enabled FastCGI, you may see session errors with sites that use php sessions (like sites running WordPress, Drupal, Joomla, etc.). To correct these issues, you'll need to assign a new session.save_path, or simply run this command (as root via ssh) to alter the permissions of the default session storage path:

chmod 1777 /var/lib/php/session

HTTP error when uploading files

If you experience an 'http error' when uploading files larger than 128KB, you'll need to edit your FastCGI configuration file and increase the limit, which defaults to this low value. To set this limit to 1GB, follow the instructions below:

  1. Edit the FastCGI configuration file, located at:
    /etc/httpd/conf.d/fcgid.conf
  2. Add this line to your configuration file (just below all of the other lines that start with 'Fcgid'):
    FcgidMaxRequestLen 1073741824
  3. Restart your Apache web-server service with this command:
    service httpd restart

503 HTTP Errors

If you encounter 503 errors on sites that use FastCGI, and are running Plesk 10.3.1, there may be a very simple fix for this:

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

This will correct any incorrect ownership permissions on the /var/run/mod_fcgid/sock file, which can sometimes result in 503 errors.

Changes Required Per Site

Some FastCGI issues may require that changes be made on a per-site basis, using the PHP/FastCGI configuration for each domain. Here are some common issues that may require a domain-by-domain approach:

Permissions issues

If your site was running for a while before configuring FastCGI, you may have some files or folders owned by 'apache', which your new FastCGI configuration won't be able to modify. To resolve this, you'll need to properly set ownership and permissions.

NOTE: You'll need to replace the example.com and domainuser text in the below example with your actual FTP username for this domain:

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

You may also need to adjust 'httpdocs' in the above example if this is not the path you assigned for the domain within Plesk.

PHP directives and timezone

Starting with Plesk 10.3, each site now has a unique php.ini configuration, which Plesk manages. To make custom PHP settings modifications, you need to edit 'conf/php.ini' (or create it if it does not exist), then tell Plesk to regenerate 'etc/php.ini'. For the example domain example.com, the full path to this file is:

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

Here's a good excerpt from a default 'conf/php.ini' file which will set a timezone (modify timezone to suit your server and domain):

[PHP]
date.timezone = 'America/Los_Angeles'/

TIP:
Recommended next steps:

Once you have created the 'conf/php.ini' file (or updated it with any new directives), you must tell Plesk to regenerate the php.ini configuration. To do so:

  1. Navigate to the domain's control panel.
  2. Click on 'Websites & Domains'.
  3. Click on the name of this domain.
  4. In the 'PHP support'/'Run PHP as' drop-down, select something other than FastCGI, then click 'OK' to save.
  5. Set this value back to FastCGI, and click 'OK' to save once more.
Was this article helpful?
0 out of 0 found this helpful

Comments