Jump to content

Perl / Python Scripts not running after Plesk Migration


cktrack
 Share

Recommended Posts

Seeing the error "End of script output before headers: " in the logs after trying to execute scripts in cgi-bin directory.

I've modified all the scripts to have 755 permissions (Read Execute for all) and the cgi-bin directory is set up the same way.

Do I need to grant any additional permissions to run scripts out of cgi-bin?

Do I need to change the location of perl and/or python?  Or pull down the libraries I need again?

Is there a support guide on the migration to Plesk or should it all be seemless?

Link to comment
Share on other sites

Create an .htaccess with the following in it:

Options +ExecCGI
AddHandler cgi-script .py

For Perl, just add another addhandler line for .pl.


Also, be aware that Plesk currently does not support python3, flask, or django. Krydos is going to look into installing these at some point, but that's down the road a bit yet (he wants to fix the account creation issues first). For now the server only has Python 2.7.

Link to comment
Share on other sites

7 minutes ago, cktrack said:

Do I need to grant any additional permissions to run scripts out of cgi-bin?

To run scripts outside cgi-bin you have to make the file extensions executable. You can do so with an .htaccess with contents similar to this.

Options +ExecCGI
AddHandler cgi-script .py
AddHandler cgi-script .pl
AddHandler cgi-script .rb
AddHandler cgi-script .cgi

If it gives you a 500 error try removing the "Options +ExecCGI" line because some accounts need that and some accounts that causes an error.

49 minutes ago, cktrack said:

Do I need to change the location of perl and/or python?

Perl is located at /usr/bin/perl which is a pretty standard location. Python 2.7.5 is located at /usr/bin/python. Python3 isn't installed yet, like it said in the email before you clicked "transfer me now". I plan on installing Python3 in the next week or two probably.

50 minutes ago, cktrack said:

Or pull down the libraries I need again?

Everything that is installed right now is the default stuff that comes with a fresh install. If there is anything extra you need you'll have to request it.

51 minutes ago, cktrack said:

Is there a support guide on the migration to Plesk or should it all be seemless?

There is no guide because we've never done this before so we're all figuring it out at the same time as you. If you post what you figure out on the forums we can all learn from it.

I took a look at your account and you have like a million scripts so I'm not sure which one you're trying to get working first, but I looked at hello.pl because it looked like a simple test script, and here's some stuff I noticed. First you can't use "use cPanelUserConfig;" anymore because you're not on cPanel. That line gives this error "Can't locate cPanelUserConfig.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at hello.pl line 2." because no such file exists.

Link to comment
Share on other sites

I created the .htaccess file and placed it in my public_html (aka www) folder.  It gave me the 500 error at first so I dropped the options and my scripts are still not working.  Am I putting it in the right place?  I also tried the cgi-bin directory and the root directory.

Link to comment
Share on other sites

I'm able to get hello.pl to work after removing the "use cPanelUserConfig;" statement at the top.

I did the same for user_record_detail.pl, but am still getting the same error when trying to run it.  Are there more detailed logs that I can use to identify the issue? 

Also, making a big request for python3 since all my python code is running 3.7 

Trying to get my site back up and functioning for the school year.

Link to comment
Share on other sites

Thanks @Krydos !!!  I went through the rest of my Perl code and checked all the other modules and identified 2 more that need to be installed:

Time::Piece;

Crypt::Random;

Can you please install?

Also, will there be a way for us to install additional perl modules in the future similar to the way we did it in cPanel?

Link to comment
Share on other sites

15 hours ago, cktrack said:

Time::Piece;

Installed.

15 hours ago, cktrack said:

Crypt::Random;

Can you use Crypt::OpenSSL::Random; instead?  

15 hours ago, cktrack said:

Also, will there be a way for us to install additional perl modules in the future similar to the way we did it in cPanel?

Probably not. Perl is kind of a dead language that isn't used for much anymore. Somewhere along the lines of 95% of cPanel is written in Perl though so of course they support it well. Plesk is all written in PHP and you can tell by how well they support multiple versions and everything. I imagine it's difficult for cPanel to hire new Perl programmers so not sure what they're long term plan is.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...