This article describes how to enable CGI support in Plesk to run CGI/Perl scripts. CGI support can be activated via the Hosting Settings menu, but it may take a few minutes for the change to take effect. The default path for the cgi-bin directory is the domain's root directory, while the legacy option places the cgi-bin directory in the webspace root directory. Domains like max-muster.ch and anna-muster.ch each have their own cgi-bin directories unless the legacy option is used. Access to CGI scripts is done through the URL extension /cgi-bin. If you encounter a 500 Internal Server Error, specific notes should be observed.
Enabling CGI Support
cgi-bin Directory
Calling the CGI/Perl Script
Enabling CGI Support
In Plesk, CGI support can be enabled to execute CGI/Perl scripts.
CGI support is activated in Plesk via the Hosting Settings menu. Please note that it may take a few minutes after activation for the setting to take effect.
By default, the cgi-bin folder is located in the root directory of the domain. The root directory is visible in the Hosting Settings menu:
However, some users may see the legacy option (cgi-bin directory located in the root directory of the webspace). In this case, the cgi-bin folder is located in the root directory of the subscription. If the option is switched from webspace root directory to the domain’s root directory, the legacy option will then disappear from the settings, leaving the domain root directory as the only default option.
cgi-bin Directory
Depending on whether the default setting or the legacy option is used, the cgi-bin directory is located in a different place.
Default: Domain root directory
Legacy: Webspace root directory
Default: Domain Root Directory
Each domain has its own cgi-bin directory. CGI scripts for the domain max-muster.ch are located under /httpdocs/cgi-bin, while CGI scripts for the domain anna-muster.ch are stored in the directory /anna-website/cgi-bin.
Domain: max-muster.ch
Document Root: /httpdocs
CGI-bin Directory: /httpdocs/cgi-bin
Domain: anna-muster.ch
Document Root: /anna-website
CGI-bin Directory: /anna-website/cgi-bin
Legacy: Webspace Root Directory
| This option is not available to all users as it is a legacy option. |
Both domains share the same cgi-bin directory. The scripts in the /cgi-bin directory can therefore be used by both domains.
Domain: max-muster.ch
Document Root: /httpdocs
cgi-bin Directory: /cgi-bin
Domain: anna-muster.ch
Document Root: /anna-website
cgi-bin Directory: /cgi-bin
Calling the CGI/Perl Script
The directory is accessed via the domain with the addition of /cgi-bin
Example: http://YourDomain.tld/cgi-bin/filename.cgi
If you receive a 500 Internal Server Error when calling, please note the following information: CGI, Perl: Internal Server Error