Scripts in cgi-bin no longer execute and generate a 404 error after an upgrade to Parallels Plesk Panel 11.x

Created:

2016-11-16 13:15:00 UTC

Modified:

2017-04-24 11:41:49 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Scripts in cgi-bin no longer execute and generate a 404 error after an upgrade to Parallels Plesk Panel 11.x

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 11.0 for Linux
  • Plesk 11.5 for Linux
  • Plesk 12.0 for Linux

Symptoms

  1. CGI scripts cannot be opened successfully.

  2. The location of the /cgi-bin folder is incorrect (webspace or www-root folder).

Cause

After updating from 10.x to 11.x, the location of the /cgi-bin directory could be incorrect (webspace or www-root).

By default, the location of the /cgi-bin folder in Plesk 10.x is located in the webspace root.

After upgrading, the Apache config ScriptAlias will be changed to the following:

/var/www/vhosts/domain.tld/httpdocs/cgi-bin/

However, the /cgi-bin folder will physically remain here:

/var/www/vhosts/domain.tld/cgi-bin/

... instead of in the correct location:

/var/www/vhosts/domain.tld/httpdocs/cgi-bin/

This behavior has been confirmed as an internal issue #PPPM-810 and completely fixed since Plesk 12.0.

Resolution

It is recommended to upgrade to Plesk 12.0 and above.

If for some reason this is not possible, as a workaround, the ability to manage the cgi-bin folder location for the desired domain can be restore using steps below.

Note: Before applying the solution in this article, check that the domain does not have an application which was installed into the www-root directory /en/114518

  1. First, back up the Plesk database:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin psa > psa`date +%F_%H.%M`.sql
  2. Find the ID of the desired domain:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e"select id from domains where name = 'example.com'"
    +----+
    | id |
    +----+
    | 23 |
    +----+
  3. Add this string to the psa.dom_param table:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e"insert into dom_param (dom_id, param, val) values (23,'cgi_bin_mode','www-root')"
  4. Regenerate the web server config for the domain:

    /usr/local/psa/admin/bin/httpdmng --reconfigure-domain domain.tld

After following these steps, the option "CGI support (cgi-bin directory is located in ...)" will appear in the domain hosting settings in the Plesk web interface: Websites and Domains -> Show Advanced Operations -> Website Scripting and Security -> CGI Support

Also, it will be able to choose between the old style (the root directory of the webspace) and the new one (the document root of this domain).

INFORMATION

The root directory of webspace

A typical domain file organization in Plesk 11 is as follows:

/var/www/vhosts/webspace1.tld/example1.tld/
/var/www/vhosts/webspace1.tld/example2.tld/
/var/www/vhosts/webspace1.tld/example3.tld/

Here, example domains are created under the webspace1.com webspace.

If location of /cgi-bin directory for a domain example3.com are being specified in the root directory of the webspace, its absolute path will be

`/var/www/vhosts/webspace1.tld/cgi-bin/`

The cgi_bin_mode parameter in the psa.dom_param table is set to 'webspace':

mysql> select * from dom_param where param='cgi_bin_mode' and dom_id=612;
+--------+--------------+----------+
| dom_id | param | val |
+--------+--------------+----------+
| 612 | cgi_bin_mode | webspace |
+--------+--------------+----------+
1 row in set (0.00 sec)

The document root of this domain

If that directory are being specified in the document root of this domain, its absolute path will be

/var/www/vhosts/webspace1.com/example3.tld/cgi-bin/

mysql> select * from dom_param where param='cgi_bin_mode' and dom_id=581;
+--------+--------------+----------+
| dom_id | param | val |
+--------+--------------+----------+
| 581 | cgi_bin_mode | www-root |
+--------+--------------+----------+
1 row in set (0.00 sec)

The old-style root of this domain

If the old-style root directory are being specified (this option is only available after upgrading Plesk from a previou versions), the absolute path will be

`/var/www/vhosts/domain3.tld/cgi-bin `

This option provides compatibility with the obsoleted organization of domain files on the file system.

mysql> select * from dom_param where param='cgi_bin_mode' and dom_id=582;
+--------+--------------+----------+
| dom_id | param | val |
+--------+--------------+----------+
| 582 | cgi_bin_mode | old-style|
+--------+--------------+----------+
1 row in set (0.00 sec)
Have more questions? Submit a request
Please sign in to leave a comment.