Koozali.org: home of the SME Server
Obsolete Releases => SME Server 8.x => Topic started by: del on June 22, 2013, 05:31:10 PM
-
Hi All,
I know this has been covered many times but after searching on here and on Google I have finally conceded defeat and realise I need some help :-)
I have tried all the normal things like uploaded again as ASCII, CHMOD to 755 etc. I can get the exact same script to run OK on my web hosting account so I know that everything is OK in the .pl file but I still get the dreaded "Internal Server Error" Do I have to enable anything on my server, I am using the primary i-bay so I guessed that I wouldn't have to but maybe I'm wrong (wouldn't be the first time :-)) Any help is greatly appreciated.
Regards,
Del
-
I think cgi scripts need to go into <ibayname>/cgi-bin, and you need to have CgiBin enabled for the ibay:
db accounts show <ibayname>
<ibayname>=ibay
AllowOverride=All
CgiBin=enabled
FollowSymLinks=enabled
Gid=5006
Group=admin
Name=<ibayname>
PHPBaseDir=/home/e-smith/files/ibays/<ibayname>/:/tmp/
PasswordSet=no
PublicAccess=global
Uid=5006
UserAccess=wr-group-rd-everyone
-
Hi mmccarn,
I am using the primary i-bay so when I run that command I get this output:
primary=system
I have tried creating an i-bay called sle and I still get the Internal Server Error when running the cgi script, when I run the command for that i-bay I get this output:
sle=ibay
CgiBin=enabled
Gid=5002
Group=admin
Name=sle
PasswordSet=no
PublicAccess=global
Uid=5002
UserAccess=wr-group-rd-everyone
The only difference I see is in your example is line 4 Gid=5006 is Gid=5002 and line 10 Uid=5006 is Uid=5002
So I'm at a loss with it.
Regards,
Del
-
Is there anything interesting in your log files?
/var/log/httpd/access_log (is your script being requested?)
/var/log/httpd/error_log (is your script generating an error within apache?)
/var/log/messages (is your script logging something useful here?)
-
This is what is shown -
Access log
"POST /cgi-bin/mail_ht.pl HTTP/1.1" 500 543 "http://ddj.homelinux.com/contact.html" "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0"
Error log
[Sat Jun 22 19:32:58 2013] [error] [client 192.168.0.1] (2)No such file or directory: exec of '/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl' failed, referer: http://ddj.homelinux.com/contact.html
[Sat Jun 22 19:32:58 2013] [error] [client 192.168.0.1] Premature end of script headers: mail_ht.pl, referer: http://ddj.homelinux.com/contact.html
Nothing in the message log.
-
del
Did you put the scripts into the cgi-bin subfolder that is in the ibay (automatically created by smeserver) ?
-
Maybe I am just barking up a tree however,
When I go to that URL, http://ddj.homelinux.com/contact.html, the "Send Email" button calls the script from http://192.168.0.3/cgi-bin/mail_ht.pl
Maybe change the local ip to the domain address..
When I do that I can see the script, so I suspect permissions etc are also in the game.
-
I put a copy of your script in my primary iBay cgi-bin folder with permissions of 0755 and it worked fine.
-
Hi Janet & Terryf,
Janet, yes I have put it in the cgi-bin folder
Terry, I changed that to a local address late last night to try it locally, it was http://ddj.homelinux.com/cgi-bin/mail_ht.pl I've now put that bask in there. One thing how did you get the script? I thought that the cgi-bin was not available to the public :-o
Terry what setup do yuo have? I have my server in server only mode with http forwarded from the router would this make any difference?
Regards,
Del
-
Terry, I changed that to a local address late last night to try it locally, it was http://ddj.homelinux.com/cgi-bin/mail_ht.pl I've now put that bask in there. One thing how did you get the script? I thought that the cgi-bin was not available to the public :-o
When I access the script using the URL http://ddj.homelinux.com/mail_ht.pl it displays it as a text file, simple save as and I have it.
Terry what setup do you have? I have my server in server only mode with http forwarded from the router would this make any difference?
First test was on a SME8 VM with all updates, Server Only. Forwarding should not be an issue, make sure of the permissions.
This is where I have now put the script as it is a stand alone SME8 box remote from me, again in server only mode permissions set to 0755, it will be deleted shortly - Test Mail Script (http://bschclassroom.dyndns.org/cgi-bin/mail_ht.pl)
Where is that server, is it at your home/office etc and simply run off your adsl line?
-
When I access the script using the URL http://ddj.homelinux.com/mail_ht.pl it displays it as a text file, simple save as and I have it.
Ah I see, yes that file was just put there for testing (I wanted to see if I could access it outside of the cgi-bin)
Where is that server, is it at your home/office etc and simply run off your adsl line?
That is correct (at home) in Server Only (Virgin 100mb)
All permissions are 0755.
-
If you issue the following at a command prompt without a name
db accounts show
You will get a list of all accounts, in particular it will list the settings for the primary iBay.
This is the details for the server that I had the script on:
[root@bschclassroom ~]# db accounts show
Primary=ibay
CgiBin=enabled
DriveLetter=W
Group=shared
Modifiable=no
Name=Primary i-bay
PasswordSet=no
Passwordable=no
PublicAccess=global
Removable=no
UserAccess=wr-admin-rd-group
-
This is what I get after running the command -
Primary=ibay
CgiBin=enabled
Group=shared
Modifiable=no
Name=Primary i-bay
PasswordSet=no
Passwordable=no
PublicAccess=global
Removable=no
UserAccess=wr-admin-rd-group
-
So as long as the permissions are set Ok, there would seem to be no reason why that script would not run.
Got me, it needs a smarter mind than mine to suggest further avenues of investigation.
There has to be something that is preventing the execution..
I tried it on another remote system in a iBay other than the primary, no probs as long as the permissions were 0755, what are you using to upload the file with, I am using WinSCP
-
I can get the exact same script to run OK on my web hosting account so I know that everything is OK in the .pl file but I still get the dreaded "Internal Server Error"
You have to read httpd/error_log to determine what the problem is. Just saying "it doesn't work" isn't sufficient for anyone to help you solve the problem.
-
What was the url that you put in the Dansie contact form?
It should have been in this form <FORM ACTION="http://ddj.homelinux.com/cgi-bin/mail_ht.pl" METHOD=POST>
I setup up the contact form as per the Dansie website and it worked as it should.
-
You have to read httpd/error_log to determine what the problem is. Just saying "it doesn't work" isn't sufficient for anyone to help you solve the problem.
Logs are posted further up in reply #4, but this is all it says -
Access log
"POST /cgi-bin/mail_ht.pl HTTP/1.1" 500 543 "http://ddj.homelinux.com/contact.html" "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0"
Error log
[Sat Jun 22 19:32:58 2013] [error] [client 192.168.0.1] (2)No such file or directory: exec of '/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl' failed, referer: http://ddj.homelinux.com/contact.html
[Sat Jun 22 19:32:58 2013] [error] [client 192.168.0.1] Premature end of script headers: mail_ht.pl, referer: http://ddj.homelinux.com/contact.html
Nothing in the message log.
Form/script works fine on a shared hosting account I have, just can't seem to get it to work on my server.
-
del
No such file or directory: exec of '/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl' failed, referer: http://ddj.homelinux.com/contact.html
Please run these commands & show the actual output of
cd /home/e-smith/files/ibays/Primary/
ls -al
and
cd /home/e-smith/files/ibays/Primary/cgi-bin/
ls -al
-
No such file or directory: exec of '/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl' failed, referer: http://ddj.homelinux.com/contact.html
Show output of:
ls -l /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
file /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
What happens if you type just:
/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
?
-
Hi Janet,
When I run
cd /home/e-smith/files/ibays/Primary/
ls -al
I get this
total 20
drwxr-xr-x 5 root root 4096 Jun 21 20:43 .
drwxr-xr-x 5 root root 4096 Jun 20 22:01 ..
drwxr-xr-x 2 root root 4096 Jun 23 09:29 cgi-bin
drwxr-s--- 2 admin shared 4096 Aug 1 2012 files
drwxr-s--- 3 admin shared 4096 Jun 23 16:07 html
and when I run
cd /home/e-smith/files/ibays/Primary/cgi-bin/
ls -al
I get this
total 24
drwxr-xr-x 2 root root 4096 Jun 23 09:29 .
drwxr-xr-x 5 root root 4096 Jun 21 20:43 ..
-rwxr-xr-x 1 root root 13937 Jun 21 20:44 mail_ht.pl
Hi Charlie,
When I run
ls -l /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht
.pl
I get
-rwxr-xr-x 1 root root 13937 Jun 21 20:44 /home/e-smith/files/ibays/Primary/cgi-
bin/mail_ht.pl
When I run
file /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
I get
/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl: perl script text executable
and finally if I run
/home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
I get
-bash: /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
Thank you both for taking the time to look and help.
Kind regards,
Del
-
Hi,
Your problem is that the perl script has windows style lines endings (carriage return + line feed)
You can fix it by running:
dos2unix -o /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
-
-bash: /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
dos2unix /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
-
Hi,
Your problem is that the perl script has windows style lines endings (carriage return + line feed)
You can fix it by running:
dos2unix -o /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
dos2unix /home/e-smith/files/ibays/Primary/cgi-bin/mail_ht.pl
Thank you both, that fixed it! Thank you to everyone who offered their help and time.
One question, what should I use to edit these files on a Windows PC? Is there anyway I can prevent this from happening next time? Thanks again.
Kind regards,
Del
-
One question, what should I use to edit these files on a Windows PC? Is there anyway I can prevent this from happening next time?
yes, don't use windows to edit such a file..
nano/pico/vi/whatever and you are done
-
I use perledit http://www.indigostar.com/perledit.php free for pers use