FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Perl CGI 500 Internal Server Error





Liam21
Hi I'm trying to run an extremely simple perl cgi, and it always gives me some sort of error. the one I really can't explain is the 500 Internal Server Error.

Does this server support these Perl scipts. If not, does anyone know one that does?

Thanks in advance
Daniel15
Hi,
Please check that the file is CHMODded to 0755, and try running it again.
What script are you trying to run? Did you make it, or obtain it from elsewhere?
Liam21
I am using FileZilla and have set the file attributes the readable and executable by all, but writable only by owner. This gives me the number 755 in the box at the bottom. It still gives the same error.

It is a script that I have taken and modified slightly. I realize that this can be dangerous, but I have gotten it to compile at home here, and really don't think that the code is the problem...
erlendhg
Today, I experienced exactly the same problem with all my little self written php scripts in some specified folders. I tried to chmod all the directories and files to 777, but I still just get this annoying 500 Internal Server Error.

All those scripts has worked perfect before.

What can be wrong? Is it something with the server?

-- EDIT --
I just uploaded a file in ASCII mode in one of the problem directories as "index.html" and it worked just fine. Then I renamed it to "index.php" and I get the 500 Internal Server Error....
Daniel15
erlendhg wrote:
Today, I experienced exactly the same problem with all my little self written php scripts in some specified folders. I tried to chmod all the directories and files to 777, but I still just get this annoying 500 Internal Server Error.

That's the problem. Please CHMOD the directory to 0755, as the script won't run in a directory CHMODded to 0777.
Since you're on server 1 (using cPanel), you may check your error log to see what the problem is.

Quote:
I am using FileZilla and have set the file attributes the readable and executable by all, but writable only by owner. This gives me the number 755 in the box at the bottom. It still gives the same error.

Have you tried a simple 'Hello World' script?
Code:

#!/usr/local/bin/perl
print "Hello World\n";


Save it as hello.cgi, CHMOD it to 0755, and run it. Does that work for you?
Liam21
Hi I got it to work. My problem was that I had the cgi-bin folder chmodded to 777 even though all the files in it were chmodded to 755.

Thanks for your help.
Liam21
Well I had it working now it doesn't work anymore, all I did was take delete the file and then put it back in.

Is the server down or something?
Liam21
The program worked after I changed took the "local" out of the first line.

Anyone know when you need this local and when you don't?
Bondings
Liam21 wrote:
The program worked after I changed took the "local" out of the first line.

Anyone know when you need this local and when you don't?

The path to perl is without the local, so yes you don't need it in this case. It just depends on the linux distro where it is located. So on a different server, it may be located somewhere else, like with a local folder.
erlendhg
Daniel15 wrote:
erlendhg wrote:
Today, I experienced exactly the same problem with all my little self written php scripts in some specified folders. I tried to chmod all the directories and files to 777, but I still just get this annoying 500 Internal Server Error.

That's the problem. Please CHMOD the directory to 0755, as the script won't run in a directory CHMODded to 0777.
Since you're on server 1 (using cPanel), you may check your error log to see what the problem is.


Thanks a lot!
It works fine now.
This must mean that the permissions to the files/folders somehow have changed, because everything worked just fine before.
Weird... Razz

Once again, thanks.
Daniel15
erlendhg wrote:
Daniel15 wrote:
erlendhg wrote:
Today, I experienced exactly the same problem with all my little self written php scripts in some specified folders. I tried to chmod all the directories and files to 777, but I still just get this annoying 500 Internal Server Error.

That's the problem. Please CHMOD the directory to 0755, as the script won't run in a directory CHMODded to 0777.
Since you're on server 1 (using cPanel), you may check your error log to see what the problem is.


Thanks a lot!
It works fine now.
This must mean that the permissions to the files/folders somehow have changed, because everything worked just fine before.
Weird... Razz

Once again, thanks.

It's because Bondings recently (not sure when, exactly) enabled PHP Suexec on server 1. Basically, instead of running scripts as the user 'nobody', it runs them as your actual user. However, for the scripts to run correctly, they need to be CHMODded to 0755 (for security reasons, it won't let you run a script that other people can write to).
I've had some experience with PHP Suexec at another host, so I'm familar with a lot of these problems Wink

Quote:
Anyone know when you need this local and when you don't?

Like Bondings said, it depends on the Linux distribution used on the server. Most Linux distributions will place the files in /usr/bin/.
For anyone that wants a more technical, in-depth explanation: Usually, if the version of Perl on the server is compiled from source, it will be in the /usr/local/bin directory. If it's installed from a precompiled package (a Debian package, RPM package, whatever), it will be in /usr/bin/. An exception to this is on cPanel servers which use '/scripts/easyapache' to compile PHP (which places two slightly different PHP binaries at both locations).
cmfi_germany
Wow, im really pleased and thankfull, that i find an answer ive been looking for long on the web. Im really a novice at cgi. And i had a lot of programms i wrote , but everytime i used to execute them, i got that 500 answer, from the error_log. Now i wrote the answer writen up here, i changes the order Rights from 777 to 755 Idea , and do you know what?
It works. Very Happy
So i kept the pl script on the 777mod, and change the order-mod only.

And i just feel like dancing.
So thanks very much guys.
Smile
cmfi_germany.
cmfi_germany
Well seems like if, the problem dont appear again.
May be the Gimp developper have corrected it.

Anyhow, thanx guys, for the support
Related topics
500 Internal Server Error
500 Internal Server Error!
500- Internal Server Error - DONT START NEW THREADS
500 Internal Server Error (please lock)
500 internal server error?
[help] 500 Internal Server Error server 1
500 Internal Server Error
>.<!! 500 internal server error and things I can't exp
HTTP 500 - Internal server error in my frihost forum
500 Internal Server Error
[CLOSE PLEASE - SOLVED] 500 Internal Server Error
500 Internal Server Error
500 Internal Server Error
500 internal server error upon executing PHP file
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.