(dv) 4.0:Resolve FastCGI issues

  • This page was last modified on November 8, 2011, at 12:59.
The (mt) Community Wiki is a collaborative project. Any (mt) Media Temple customer or employee may contribute. Not all articles and/or content have been tested for accuracy by (mt) Media Temple.

For officially moderated and tested articles, be sure to visit our KnowledgeBase.

From (mt) Community Wiki

Contents


Overview

If you have enabled PHP to run as FastCGI on your (dv) Dedicated-Virtual Server 4.0, this article may help you resolve some issues.


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

One-Time Configuration Changes

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 seems to default to this extremely low value; The previous default was 1 GB. To set this back to 1 GB:

  1. Edit the following file:

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

    Add this line (just below all of the other lines that start with 'Fcgid'):

    FcgidMaxRequestLen 1073741824
    
  2. Restart your Apache web-server service with this command:

    service httpd restart
    

503 HTTP Errors

If you started out with Plesk 10.3.1 and notice 503 errors on the sites that use FastCGI, there's a very simple fix for this:

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

The permissions on the default install of Plesk 10.3.1 has incorrect ownership permissions on the /var/run/mod_fcgid/sock file, and this will correct it.

Changes Required Per Site

Permission 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. Run these commands to properly set ownership and permissions. You'll need to replace the domainuser text with your actual FTP username for this domain.

Run this command via SSH as your root user (after replacing example.com and domainuser):


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' if this is not the path you assigned for the domain within Plesk.

PHP Directives, 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/example.com/conf/php.ini

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

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

Click here to see a list of PHP's supported timezones.

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.

This is cumbersome, but comes straight from Plesk's administration guide.

If you are using a Plesk version earlier than 10.3 (such as 10.1.1), all FastCGI-enabled sites will use directives from '/etc/php.ini', so make your changes there. I suggesting finding and changing the values for safe_mode (change from 'On' to 'Off'), and setting a proper timezone (date.timezone).

See also