Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #11  
Old 5th December 2005, 00:48
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

Again the same:

"Internal 500 server error".files are there where they have to be
It's not File not found error.

How to investigate what causes internal 500 error?
Reply With Quote
Sponsored Links
  #12  
Old 5th December 2005, 02:29
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

When I create sample first.pl ---> first.cgi

Quote:
#!/usr/bin/perl
print "Content-type: text/html\r\n\r\n";
print "Hello, World.";
(which can be executed on another machine, of course, and put him in same directory where is monitorix.cgi (/var/www/web7/cgi-bin/)

it is also NOT executing, and the error is the same:
Internal server error: 500

It seems that Apache do not won't to execute cgi scripts?
(In ISPCOnfig , cgi is ENABLED)

If I try toput that simple script in ANY other web directory -- it's the same: Internal Server Error: 500

Last edited by nenad; 5th December 2005 at 02:31.
Reply With Quote
  #13  
Old 5th December 2005, 04:20
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

If I do:
Quote:
tail -f /var/www/web7/log/error.log
output is: ...[client 10.40.242.186] Premature end of script headers: first.cgi
Now, if I delete
Quote:
#!/usr/bin/perl
from Hello, world script, then output is the same?

Quote:
tail -f /var/www/web7/log/error.log
output is: ...[client 10.40.242.186] Premature end of script headers: first.cgi
Does that really means that apache don't call perl for executing the cgi scripts?

permissions are set to 755 as they should be, user is apache as it should be...
perl is located in /usr/bin/perl and it is working (if not called from apache)
Reply With Quote
  #14  
Old 5th December 2005, 10:53
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,745 Times in 2,578 Posts
Default

Quote:
Originally Posted by nenad
When I create sample first.pl ---> first.cgi


(which can be executed on another machine, of course, and put him in same directory where is monitorix.cgi (/var/www/web7/cgi-bin/)

it is also NOT executing, and the error is the same:
Internal server error: 500

It seems that Apache do not won't to execute cgi scripts?
(In ISPCOnfig , cgi is ENABLED)

If I try toput that simple script in ANY other web directory -- it's the same: Internal Server Error: 500
Did you try the test files? http://www.howtoforge.com/forums/showthread.php?t=171

Have you made you cgi/pl script executable (chmod 755 or chmod 775)?

Make sure it has Unix linebreaks instead of Windows linebreaks!

You must put cgi/pl scripts in the cgi-bin directory, no other directory will work!
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #15  
Old 5th December 2005, 11:21
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

Quote:
Did you try the test files? http://www.howtoforge.com/forums/showthread.php?t=171
Yes, I did. Same result. "Premature end of script"

Quote:
Have you made you cgi/pl script executable (chmod 755 or chmod 775)?
Yes, I tried both 755 and 775
Quote:
Make sure it has Unix linebreaks instead of Windows linebreaks!
No, there are Unix linebreaks (file was created on FC4 os, using putty and joe editor inside of it. There was no even "W" from windows.

Quote:
You must put cgi/pl scripts in the cgi-bin directory, no other directory will work!
Yes, of course they were in cgi-bin directory. Otherwise there would be "File not found error" instead of "Internal Server Error", and there wouldn't be "premature end of script" in log files.

I even set up script for "apache user" and "apache group", just in case that suexec directives are set not to execute "root" user group etc.

It is pretty obious that Apache DO NOT execute scripts in cgi-bin.
I can put inside any script, at the begening of the file next line:
"mickey mouse and donald duck are big friends" instead of #!/usr/bin/perl,
and there will be the same error in httpd log file : "premature end of script"

when I chechk each perl script with perl -wc syntax is OK.
when I do perl -w hello_world.pl output is displayed
in my script first.pl there was also
Quote:
print "Content-type: text/html\n\n";
to avoid STDOUT (anyway that's not the case, because there will be a log about STDOUT)

The interesting part is that PHP script won't execute???
In /web directory it is executing with no flaws...

P.S. mod_perl is loaded into apache

info.php and ssi.shtml work in /web directory
*.pl scrpits work inside cgi-bin if they are invoked with "./" or "perl -w"

Last edited by nenad; 5th December 2005 at 11:46.
Reply With Quote
  #16  
Old 6th December 2005, 18:42
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

Help, please?

Anyone?
Reply With Quote
  #17  
Old 6th December 2005, 19:55
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,745 Times in 2,578 Posts
Default

Quote:
Originally Posted by nenad

The interesting part is that PHP script won't execute???
In /web directory it is executing with no flaws...
PHP aren't executed in cgi-bin, so that's ok.

Is Perl in /usr/bin/perl? Please post the output of
Code:
which perl
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #18  
Old 6th December 2005, 20:31
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

[root@noc cgi-bin]# which perl
/usr/bin/perl
[root@noc cgi-bin]#

PHP info is located at: http://noc.homelinux.com/phpinfo.php

(ISPConfig is located also at https://noc.homelinux.com:81)

Last edited by nenad; 6th December 2005 at 20:50.
Reply With Quote
  #19  
Old 6th December 2005, 23:05
nenad nenad is offline
Senior Member
 
Join Date: Nov 2005
Location: Novi Sad, Serbia
Posts: 415
Thanks: 13
Thanked 5 Times in 5 Posts
Default

I found what is problem.
And I found solution
---------------------------------------
Quote:
tail -f /var/log/httpd/suexec.log
Informed me that there is:
Quote:
target uid/gid (10005/10007) mismatch with directory or program (48/48)
So, I chechked who is owner of files (user or group) and I found out that it is root, or apache or some '506' (for test files that I downloaded from this forum.

I didn't used built-in ISPConfig FTP or any standalone FTP , so probably because of that owbership was not set to web7_nenad & web7 user/group.

I downloaded files using wget, and I was loged as user 'root' through SSH (putty)
few days ago I used FTP to download/upload monitorix etc., so that's why there was no this kind of problems.

And I login using 'root' instead of username (web7_nenad).
That caused all of the problems becuse of improper file ownership.

-------------------------------------------
So,
in /var/www/html/ is located monitorix (by default rpm installation)

files and direcories from /var/www/cgi-bin/ are moved to
var/www/web7/cgi-bin directory

for all files and directories in var/www/web7/cgi-bin (monitorix.cgi, monitorix) file owbership are changed from root and apache to web7_nenad and web7 (user& group)

I lost few days with this issue, but I learned a LOT about apache, suexec, 500 Internal Server Error etc.

And...
Thanks a lot for your support

Regards,
Nenad

P.S.
test ssi.shtml is now at: http://www.web-hosting-solutions.biz/ssi.shtml
test env.pl is at: http://www.web-hosting-solutions.biz/cgi-bin/env.pl
test phpinfo.php is at: http://www.web-hosting-solutions.biz/phpinfo.php
Monitorix is at: http://www.web-hosting-solutions.biz/monitorix/
(there are still some unresolved issues with creating of images for Monitorix, but that's the problem of Monitorix, and I think I am going to resolve that this night).
update: directory var/www/web7/web/monitorix/imgs also needs to be set as same user/group, in my case: web7_nenad and web7 . So everything works fine now

Last edited by nenad; 26th March 2006 at 16:01.
Reply With Quote
  #20  
Old 19th January 2006, 23:27
cnlnetworks cnlnetworks is offline
Junior Member
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Lightbulb I use this to get it to work for me!

Install it like normal.

Copy all cgi and web files to the virt user directory you are useing to access it.


then edit the cron file like so: ( this is for me you will have to adjust the rsync line to fit your system. )

vi /etc/cron.d/monitorix


#!/bin/bash
#
# @(#) Fibranet NSP, SL
# Copyright (C) 2005 by Jordi Sanfeliu <admin@fibranet.com>
#

* * * * * root ps -C monitorix.pl --no-headers || /usr/sbin/monitorix.pl update
* * * * * /usr/bin/rsync -av /var/www/html/monitorix/imgs/ /home/www/Dashboard.cnl-networks.net/web/monitorix/imgs
00 00 * * * root /usr/sbin/monitorix.pl collect
01 00 1 * * root /usr/sbin/monitorix.pl report

exit 0

#################################



And so it updates like it wants to and then I rsync the directories.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:39.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.