Enabling FastCGI on MediaTemple

This article applies to enabling FastCGI support for PHP scripts on MediaTemple hosting.

Following sequence of commands/actions as mentioned below. Order is important!

1. Check how your PHP scripts are served?

Create a file with name “info.php” on your domains webroot directory – example path:** “/var/www/vhosts/example.com/”**

Add following codes in it.** **

<?php phpinfo(); ?>

After saving file like above access URL from browser: http://example.com/info.php

In output, look for option Server API **and its value. It must be **”CGI/FastCGI”.

2. Login via Plesk panel and enable CGI as well as FASTCGI support for the domain in question, say for example.com

For domain in question, make sure following options are configures:

  • PHP – Enabled
  • PHP ‘safe_mode’ – Disabled
  • CGI – Enabled
  • FastCGI – Disabled

See following screenshot for reference:

Plesk-8.6.0-CGI-FASTCGI-Settings-1

3. Login as root over SSH and execute following commands

1. Move to webroot directory for exmaple.com

cd /var/www/vhosts/example.com

2. Copy php-cgi file to bin sub-directory under **example.com **

cp /usr/bin/php-cgi bin/

3. Change owner for bin directory and its content (that includes php-cgi file)

chown -R username:psacln bin

(replace username with your FTP login name for this domain)

4. Create a vhost.conf file in conf sub-directory under **example.com **

vi conf/vhost.conf

5. Paste following content in that file. DO NOT forget to replace example.com with your actual domain name.* *

AddHandler fcgid-script .php .php5
<Directory /var/www/vhosts/example.com/httpdocs>
   FCGIWrapper /var/www/vhosts/example.com/bin/php-cgi .php
 allow from all
</Directory>

6. Run following command so that Plesk will update its configuration including apache server restart

/usr/local/psa/admin/sbin/websrvmng -a -v

7. Jump to the first step and verify PHP Server API. It should now look like as highlighted in following screenshot.

phpinfo-says-FASTCGI-now

8.DO NOT forget to change owner of files that were created using PHP running as Apache module

cd httpdocs             #DO NOT FORGET THIS COMMAND ELSE YOU WILL CRY FOR SURE
chown -R username:psacln *

(replace username with your FTP login name for this domain)

Discuss your project
with our experts

No obligation. Limited slots.

Contact Form Business Enquiry

"*" indicates required fields

Please attach any RFP, project specification, or document that you would like to share.
Drop files here or
Max. file size: 5 GB.
    This field is for validation purposes and should be left unchanged.