cancel
Showing results for 
Search instead for 
Did you mean: 

Perl Script not Working Since Migration

tinmanbf
Newbie
Posts: 6
Registered: ‎23-02-2014

Perl Script not Working Since Migration

Hi,
I've been running a Perl script for probably about 5 years but since migration to the new platform it doesn't work.
When you goto the scripts location it just displays the script itself.
Is the perl location still /usr/bin/perl ?Huh
Regards,
Ben
19 REPLIES
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: Perl Script not Working Since Migration

You may need either to add
AddHandler cgi-script .cgi .pl

to your .htaccess, or move the script to the cgi-bin directory. It'll still need 700 permissions.
Gabe
tinmanbf
Newbie
Posts: 6
Registered: ‎23-02-2014

Re: Perl Script not Working Since Migration

Hi Gabe,
When I go into filemanager I can't find the .htaccess file anywhere?
I've tried putting it into the CGI-BIN directory but still no luck...
tinmanbf
Newbie
Posts: 6
Registered: ‎23-02-2014

Re: Perl Script not Working Since Migration

No worries, managed to find the .htaccess file by going in to the ftp site using Filezilla, removed the ##RewriteRule ^cgi-bin(/.*|)$ CGI-BIN$1 [L,NC]## so the files were being picked up in the real cgi-bin directory then chmod them to 777, this enabled the script to run..
Thanks,
Ben
Superuser
Superuser
Posts: 9,869
Thanks: 1,227
Fixes: 71
Registered: ‎06-04-2007

Re: Perl Script not Working Since Migration

There's no need for the scripts in /cgi-bin to be chmod 777, they should run with chmod 700.
As long as there are no non-cgi script files (eg .php) in /public/cgi-bin moving its contents to the root /cgi-bin and disabling the root /.htaccess should be OK for most users.
David
David
andydg
Grafter
Posts: 44
Thanks: 10
Registered: ‎16-03-2010

Re: Perl Script not Working Since Migration

I have just been migrated and trying to work through few small issues - I can't seem to get my perl scripts to run.
I think I may have deleted a CGI-BIN folder as when I first logged on (oops) - there appeared to be two ...  I still have a folder in the root 'cgi-bin' and one under public but I get a file permission error when trying to write anything to the one under public.
I also get a permission error when I try and do anything to the .htaccess in the root ...
Any help appreciated ...
Superuser
Superuser
Posts: 9,869
Thanks: 1,227
Fixes: 71
Registered: ‎06-04-2007

Re: Perl Script not Working Since Migration

Deleting /public/CGI-BIN will cause problems since the root /.htaccess will be directing /cgi-bin URLs to the now missing location. The file permissions on /.htaccess should be 644 (rw-r--r--). Are yours set differently?
David
David
andydg
Grafter
Posts: 44
Thanks: 10
Registered: ‎16-03-2010

Re: Perl Script not Working Since Migration

Indeed I guessed as much. I have remade a directory 'public/CGI-BIN' - but I still have a 'public/cgi-bin' which seems now inaccessible .. is this case-sensitive?
Should my perl scripts be in the root version or the public/ (and then how should I set paths to other files within that script)?
the .htaccess has permission 644 but I seem unable to write to it (filezilla gives a 'critical file transfer error')
Andy
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: Perl Script not Working Since Migration

If you want a working cgi-bin under /public, then, doing it the Hostopia way, your /public/CGI-BIN should be a symlink to your /public/cgi-bin. As David has mentioned previously, this is a bit over-complicated. An alternative would be to place your .pl scripts in a location of your choice under /public, anything except /public/cgi-bin, and add the line mentioned above to a .htaccess file in /public or a directory below it. You can then use paths relative to that script.
Is the .htaccess file in / owned by root 0?
Gabe
Superuser
Superuser
Posts: 9,869
Thanks: 1,227
Fixes: 71
Registered: ‎06-04-2007

Re: Perl Script not Working Since Migration

On Linux systems all directory and file names are case sensitive.
If all your pre-migration /cgi-bin content is independent of non /cgi-bin content (and vice versa), in my opinion it's far easier to put pre-migration /cgi-bin content in post-migration root /cgi-bin and remove the root /.htaccess along with /public/cgi-bin and /public/CGI-BIN.
I suggest seeing if the Control Panel File Manager application can delete the root /.htaccess file - it should be able to.
David
David
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: Perl Script not Working Since Migration

Unless users have compelling legacy reasons to retain /cgi-bin in their urls, it's an unnecessary relic complication that's best consigned to history-bin.
Meanwhile, Hostopia's fix should help to minimise the number of sites broken during migration.
Gabe
andydg
Grafter
Posts: 44
Thanks: 10
Registered: ‎16-03-2010

Re: Perl Script not Working Since Migration

Thanks guys.
Still don't seem to have access to my root .htaccess (or to get a script to run from root /cgi-bin) but have added .htaccess in my /public (per Gabe's suggestion above) and moved my cgi scripts to a another directory there - and all seems to work fine now  Smiley.

One other quick thing (maybe covered elsewhere in forums) .. I had used Gabe's fix for tmp php session files using php.ini, is this still needed/possible on new server?
Superuser
Superuser
Posts: 9,869
Thanks: 1,227
Fixes: 71
Registered: ‎06-04-2007

Re: Perl Script not Working Since Migration

User php.ini files are completely ignored on the new server so that fix will do nothing, though it does no harm. It's much less likely that the sessions storage folder will run out of space on Hostopia.
Gabe's comments here provide more information including how to tidy up by removing your php.ini file and the links to it.
David
tinmanbf
Newbie
Posts: 6
Registered: ‎23-02-2014

Re: Perl Script not Working Since Migration

Hmmmm seems like all my files have been set back to 1st migration state and they have removed the permission to change the .htaccess  file!! Permission denied error!! So all my scripts are failing once again!
Superuser
Superuser
Posts: 9,869
Thanks: 1,227
Fixes: 71
Registered: ‎06-04-2007

Re: Perl Script not Working Since Migration

See my reply in the other thread. However hopefully we'll get an explanation of what's happened when Plusnet forum staff are here again on Monday. Ideally that will include arranging for file and database content to be restored to what they were before the screw up.
David
David