• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Problem with cgi/perl scripts

jola

Basic Pleskian
I am migrating a large site to plesk and we are having big problems to get cgi/perl scripts to work. At first we thought the problems might be because we were using the old Plesk 8 version. We only ran Plesk 8 because we wanted to use the migration manager available only in Plesk 8. However, we have now upgraded to the latest plesk 10 version and we are still having the same problems. Most our perl scripts are not working under plesk. I have tried to debug this and have noticed several problems, here is a very simple example:

A have written a test file called bar.pl that contains:

Code:
#!/usr/bin/perl
print("Content-type: text/plain\n");
print("\n");
print("hello world\n");

Accessing this file via http displays "hello world" in my browser, as it should

If have also written a second file foo.pl that contains:

Code:
#!/usr/bin/perl
require "/var/www/vhosts/website.com/httpdocs/bar.pl";

Many of our perl cgi scripts use this technique to include subroutines via a require statement.

In this example, foo.pl should just include and execute the bar.pl file and display the same "hello world" message. However, accessing foo.pl via http only works intermittently. Sometimes it shows "hello world", but most of the time it will not display anything but just show an empty page. I have discovered that if I restart apache (/etc/init.d/httpd restart) foo.pl will always work once and then it fails again. access_log and error_log files indicate no problems, aside from the fact that access_log shows less characters being output when the blank-page error occurs.

I noticed earlier also that if I in Plesk 8 changed the domain from being an IP-based domain to a name-based domain using the common plesk IP number cgi/perl worked as it should and my example above had no problems.

Anyone have any clues about what this can be related to? Perl under plesk on IP based sites does not seem to work in the same way as perl worked under my previous hosting environment. We have tried to solve this for a couple of weeks now without finding any solution and we will soon be forced to abandon our plans to migrate to plesk and instead move to a different hosting environment where our cgi/perl scripts work.
 
Last edited:
We have found a way to make our perl/cgi scripts work. If I in plesk turn off perl for the site and only run perl as a cgi script without mod_perl our scripts work.
 
Thanks Jola! Turning off Perl makes perl scripts work... go figure. You saved me some major headaches.
 
I'm migrating from Plesk 8 to Plesk 12 and ran into the same problem. I have a Web Host Pro subscription and support at my host could not figure it out. I went into the Websites & Domains -> Hosting Settings and unchecked Perl Support leaving CGI Support checked. Perl scripts then ran great! Thank you for this solution - hopefully someone else will find this useful as well.
 
Back
Top