#1  
Old 18th January 2008, 14:53
zetnsh zetnsh is offline
Senior Member
 
Join Date: Aug 2007
Posts: 111
Thanks: 8
Thanked 5 Times in 5 Posts
Default Revisit: perl CGIs with suphp

Hi there,

I was looking for the answer months ago, never found it, and it was never really an issue then

I have successfully installed suphp with ISPConfig which works fine, PHP scripts run as the website user rather than apache user, but I always came unstuck getting it to run CGI's -I just don't know where to start with the apache config etc.

Here is /etc/suphp.conf:
Code:
[global]
;Path to logfile
logfile=/var/log/httpd/suphp_log
;Loglevel
loglevel=info
;User Apache is running as
webserver_user=apache
;Path all scripts have to be in
docroot=/
;Path to chroot() to before executing script
;chroot=/mychroot
;Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true
;Send minor error messages to browser
errors_to_browser=false
;PATH environment variable
env_path=/bin:/usr/bin
;Umask to set, specify in octal notation
Here is /etc/httpd/conf.d/suphp.conf:

Code:
LoadModule suphp_module modules/mod_suphp.so
And finally attached as a .txt file is httpd.conf (overkill probably - I know!)

Any thoughts would be much appreciated!

Neil
Attached Files
File Type: txt httpd.conf.txt (34.4 KB, 186 views)
Reply With Quote
Sponsored Links
  #2  
Old 18th January 2008, 15:27
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Default

Did you enable "CGI Scripts" and/or "Standard CGI Scripts"
on the basis tab within ISPConfig for that website?

The cgi-scripts must be placed within the folder "cgi-bin" or "bin" within the webspace of your website.
__________________
Hans

MrHostman | Master in managed hosting
Reply With Quote
  #3  
Old 18th January 2008, 17:08
zetnsh zetnsh is offline
Senior Member
 
Join Date: Aug 2007
Posts: 111
Thanks: 8
Thanked 5 Times in 5 Posts
Default

Hi Hans, thanks for responding!

Yes, CGI Scripts was ticked.

The CGI scripts are in a folder called cgi-bin on the same level as the web directory for that user. They all work fine, it's just they don't run as the user of the web!

I've just run this perl test script:

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n$< $>\n";
This tells me the user the script is running as (and in fact the user it would be running as if it was setuid which it isn't).

This comes back with

Code:
48   48
which is the uid of the apache user on my system.

Any other thoughts anyone?

Thanks,

Neil
Reply With Quote
  #4  
Old 18th January 2008, 17:19
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Default

Did you create an admin user for that website?
If you have created an admin user for that website, your cgi scripts should run automaticly under that admin user.
__________________
Hans

MrHostman | Master in managed hosting
Reply With Quote
  #5  
Old 18th January 2008, 17:28
zetnsh zetnsh is offline
Senior Member
 
Join Date: Aug 2007
Posts: 111
Thanks: 8
Thanked 5 Times in 5 Posts
Default

Bear in mind this is perl not php (did I explain that?). The PHP side is working correctly, it's just Perl CGI's that are the problem.

Yes, there is an admin user set up, the same one that owns the files!

Any thoughts?

Thanks,

Neil
Reply With Quote
  #6  
Old 18th January 2008, 18:15
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 212
Thanked 648 Times in 294 Posts
Default

Yes i know, please have also a look here: http://www.howtoforge.com/forums/sho...ight=cgi+suphp.

Till, confirms what i've told you.
__________________
Hans

MrHostman | Master in managed hosting
Reply With Quote
  #7  
Old 18th January 2008, 20:08
zetnsh zetnsh is offline
Senior Member
 
Join Date: Aug 2007
Posts: 111
Thanks: 8
Thanked 5 Times in 5 Posts
 
Default

Just to confirm on this, here is my test CGI program written in perl:

Code:
[root@historydirect cgi-bin]# ls -al /var/www/web1/cgi-bin/testperm.cgi
-rwxr-xr-x 1 web1_historydirect web1 59 Jan 18 16:01 /var/www/web1/cgi-bin/testperm.cgi
That seems to look right with what you told me...

Thanks again,

Neil
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
suPHP file permission catalyst General 14 7th March 2010 01:16
suPHP -couldn't create child process error tipsy HOWTO-Related Questions 10 26th November 2007 00:56
Runaway Perl aws910 Server Operation 2 19th November 2007 17:24
Perl and cgi script installation linuxuser1 General 30 26th April 2006 23:09
Perl non-printable chars and unwanted formatting spinoza Programming/Scripts 4 1st April 2006 20:30


All times are GMT +2. The time now is 12:02.


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