• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

Ubuntu LAMP Perl Errors

We are currently trying to move a website from an IIS server to an Apache one, and are having trouble with some of the perl scripts.

We get the following error when the site calls the perl script:
The server encountered an internal error or misconfiguration and was unable to complete your request.

There are no issues with it running in IIS, and I can also run the perl script from the command line without errors.

I see no errors in the log at /var/log/apache2/error.log that look related.
0
TacoFlavoredKisses
Asked:
TacoFlavoredKisses
  • 5
  • 5
  • 3
1 Solution
 
Adam314Commented:
Is /var/log/apache2/error.log your error log for this server?  Are the scripts marked as executable by the web server user?  Can you run any perl scripts?  If so, are they in the same directory as the ones you can not run?
0
 
TacoFlavoredKissesAuthor Commented:
I believe this is where the logs are.  I see other errors here.
The scripts are marked as executable.  I can run test perl scripts with no issues.  They are in the same directory.
0
 
Adam314Commented:
I'm guessing that there is something in the log that is relavant.  Try this:
    Look at the log, and not the last error
    Try running one of the scripts that does not work
    Look at the log again, and see if there are any additional errors.

If you had the scripts on a windows machine, it could be that you have windows style line endings, not unix style.  How did you transfer the files from windows to unix?  To fix, you can use the dos2unix program.  Or this perl statement:
    perl -i -pe 's/\r//g' filename.pl
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
TacoFlavoredKissesAuthor Commented:
I ran the perl statement and tried again.  Got these errors.

[Mon Feb 16 11:51:35 2009] [error] [client 64.246.146.231] (13)Permission denied: exec of '/home/bpiweb/Websites/site2/er_info_request/info_formmail.pl' failed, referer: http://site2.com/er_info_request/index.htm
[Mon Feb 16 11:51:35 2009] [error] [client 64.246.146.231] Premature end of script headers: info_formmail.pl, referer: http://site2.com/er_info_request/index.htm
0
 
TacoFlavoredKissesAuthor Commented:
After doin g a chmod +x to the file, the script is running.

THose errors did not exist though before I ran the perl command you gave me.

There are many perl scripts, is there a way to get this to run against all of them?
0
 
FishMongerCommented:
Using apache, perl scripts normally go in/under the cgi-bin directory, unless you've setup an alternate ScriptAlias location.

What are the permission and ownership settings of the script?
Do you have a cgi-bin directory?
Are you able to run any other perl cgi scripts?
0
 
FishMongerCommented:
chmod +x *.pl
0
 
TacoFlavoredKissesAuthor Commented:
They are all in other folders, and I was more looking for the way to do the perl command perl -i -pe 's/\r//g' filename.pl

0
 
Adam314Commented:
If that perl command solves the problem, it means you had windows style line endings on your files.  You can use this to go through all folders:
    change to the top level directory containing your scripts
    find . -name \*.pl -type f -exec perl -i -pe 's/\r//g' {} \;

Note that if you have any files that end in .pl, this will change those - even if they aren't perl files.  
0
 
FishMongerCommented:
Or, you could use dos2unix

find . -name \*.pl -type f -exec dos2unix -k {} \;
0
 
FishMongerCommented:
I'm not sure if this was part of your question, but the chmod command has the -R option to change files and directories recursively.

chmod -R +x *.pl
0
 
FishMongerCommented:
I just noticed that Adam mentioned dos2unix but didn't include an example of its usage.  It should be mentioned that, in this case, dos2unix would be more efficient that the perl command.  However, if we're talking about a reasonable number of files, then you may not notice much difference.
0
 
TacoFlavoredKissesAuthor Commented:
After changing these and then rechanging the permissions to be executable all is working well.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 5
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now