1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Problem with cgi/perl scripts

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by jola, Jan 7, 2011.

  1. jola

    jola Basic Pleskian

    19
    60%
    Joined:
    Dec 26, 2010
    Messages:
    40
    Likes Received:
    1
    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: Jan 7, 2011
  2. fogelf

    fogelf Regular Pleskian

    23
    37%
    Joined:
    Feb 10, 2010
    Messages:
    103
    Likes Received:
    0
  3. jola

    jola Basic Pleskian

    19
    60%
    Joined:
    Dec 26, 2010
    Messages:
    40
    Likes Received:
    1
    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.
     
  4. jojo777

    jojo777 Guest

    0
     
    Thanks Jola! Turning off Perl makes perl scripts work... go figure. You saved me some major headaches.
     
  5. Rick Torzynski

    Rick Torzynski New Pleskian

    1
     
    Joined:
    Aug 22, 2015
    Messages:
    1
    Likes Received:
    0
    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.
     
Loading...