Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix CGI Scripts That Do Not Work in Plesk

This guide helps you find out why a CGI script fails on your Plesk site, and how to fix it.

Plesk2 min read11 steps

What is a CGI script?

A CGI script is a small program that runs on your server when a visitor opens a page. Many old contact forms and counters use them. They are often written in Perl or Python and live in a folder named cgi-bin.

When they fail, you usually see "500 Internal Server Error" or the plain code is shown on the page. A 500 error means the server tried and failed.

Step 1: Turn on CGI support

  1. Log in to Plesk.
  2. Go to Websites & Domains.
  3. Click Hosting Settings for your domain.
  4. Under Services or Dynamic website settings, tick CGI support. Tick Perl support too if your script uses Perl.
  5. Click OK.

If the box is missing, your plan may not allow CGI. Ask Hostvento support.

Step 2: Put the script in the right folder

  1. Open File Manager in Plesk.
  2. Go to your domain folder and find cgi-bin. It sits next to httpdocs.
  3. Upload your script there.

Scripts outside cgi-bin usually do not run as CGI.

Step 3: Set the right permissions

Permissions say who may read or run a file. A script must be allowed to run.

  1. In File Manager, click the permissions link next to the script.
  2. Tick Execute for the owner. A normal safe value is 755.
  3. Click OK.

Warning: Do not use 777. It lets anyone change the file. The server may block it too.

Step 4: Check the first line

The first line of the script tells the server which program runs it. For Perl, it often looks like this.

#!/usr/bin/perl

This line points to Perl. The path must match the server. Ask Hostvento support for the right path.

Step 5: Check line endings and logs

  • A script saved on Windows may have the wrong line endings. Save it with Unix line endings in your editor, and upload it as text.
  • Open Logs for your domain in Plesk. Look at the error log. It names the problem.
Tip: If the log says "premature end of script headers", the script did not print the right first lines. Print a content type line first, then a blank line.

Still stuck? Open a support ticket and send the log lines.

Quick recap

  • Turn on CGI support in Hosting Settings.
  • Keep scripts in cgi-bin.
  • Set permissions to 755.
  • Check the first line and the error log.