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
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?
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...
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....
| 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?
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.
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?
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?
| 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.
| 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...
Once again, thanks.
| 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...
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
| 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).
Wow, i´m really pleased and thankfull, that i find an answer i´ve been looking for long on the web. I´m 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
, and do you know what?
It works.
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.
cmfi_germany.
Well seems like if, the problem don´t appear again.
May be the Gimp developper have corrected it.
Anyhow, thanx guys, for the support