Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 23rd July 2008, 19:47
Elfchen Elfchen is offline
Member
 
Join Date: Jun 2007
Posts: 56
Thanks: 2
Thanked 1 Time in 1 Post
Question can not execute cgi-script

Can not execute cgi scripts in cgi-bin directory:

Code:
Wed Jul 23 19:38:58 2008] [error] [client ???.78.165.69] suexec policy violation: see suexec log for more details
[Wed Jul 23 19:38:58 2008] [error] [client ???.78.165.69] Premature end of script headers: hello.cgi
Script:

PHP Code:
cat cgi-bin/hello.cgi
#!/usr/bin/perl

# hello.pl -- my first perl script!

print "Content-type: text/html\n\n";

print 
"Hello, world!\n"
Directory:

Code:
ls -la
insgesamt 32
drwxr-xr-x  8 www-data web7 4096 2008-07-14 04:00 .
drwxr-xr-x 13 root     root 4096 2008-07-14 02:14 ..
drwxr-xr-x  2 www-data web7 4096 2008-07-23 17:53 cgi-bin
-rw-rw-r--  1 root     web7    0 2008-07-23 04:00 .htpasswd
drwxr-xr-x  3 www-data web7 4096 2008-07-15 00:30 log
drwxrwxrwx  2 www-data web7 4096 2008-07-14 02:14 phptmp
drwxr-xr-x  2 www-data web7 4096 2008-07-14 02:14 ssl
drwxr-xr-x  2 www-data web7 4096 2008-07-14 02:14 user
drwxrwxr-x  7 www-data web7 4096 2008-07-23 19:37 web
File itself:

Code:
-rwxr-xr-x 1 www-data   web7  117 2008-07-23 17:43 hello.cgi
Vhost-config

Code:
#
#
#
######################################
# Vhost: www.domain.tld:80
######################################
#
#
<VirtualHost 1.2.3.4:80>
<Directory "/var/www/web7/cgi-bin">
Options ExecCGI
</Directory>
SuexecUserGroup nobody web7
ServerName www.domain.tld:80
ServerAdmin webmaster@domain.tld
DocumentRoot /var/www/web7/web
ServerAlias domain.tld
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
Alias  /cgi-bin/ /var/www/web7/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
ErrorLog /var/www/web7/log/error.log
AddType application/x-httpd-php .php .php3 .php4 .php5
<Files *.php>
    SetOutputFilter PHP
    SetInputFilter PHP
</Files>
<Files *.php3>
    SetOutputFilter PHP
    SetInputFilter PHP
</Files>
<Files *.php4>
    SetOutputFilter PHP
    SetInputFilter PHP
</Files>
<Files *.php5>
    SetOutputFilter PHP
    SetInputFilter PHP
</Files>
php_admin_flag safe_mode Off
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Alias /error/ "/var/www/web7/web/error/"
ErrorDocument 400 /error/invalidSyntax.html
ErrorDocument 401 /error/authorizationRequired.html
ErrorDocument 403 /error/forbidden.html
ErrorDocument 404 /error/fileNotFound.html
ErrorDocument 405 /error/methodNotAllowed.html
ErrorDocument 500 /error/internalServerError.html
ErrorDocument 503 /error/overloaded.html
AliasMatch ^/~([^/]+)(/(.*))? /var/www/web7/user/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web7/user/$1/web/$3
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
  RewriteRule .* - [F]
</IfModule>
</VirtualHost>
#
#
It makes no difference if I add or remove this in ISPConfig:

Code:
<Directory "/var/www/web7/cgi-bin">
Options ExecCGI
</Directory>
In ISPConfig Webpanel I have activated CGI for this Vhost.

File is set to 755.

What do I wrong here?

Help please. Thank you.
Reply With Quote
Sponsored Links
  #2  
Old 23rd July 2008, 20:04
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,777
Thanks: 821
Thanked 5,332 Times in 4,184 Posts
Default

Please create a administrator user for the website and then chown the cgi script so that it is owned by the web admin.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 23rd July 2008, 20:36
Elfchen Elfchen is offline
Member
 
Join Date: Jun 2007
Posts: 56
Thanks: 2
Thanked 1 Time in 1 Post
Default

Thank you for your very fast reply on my post.

Can you please tell me how to create an administrator?

I think I have to create the admin in ISPConfig "User and email" and to activate administrator. Is this correct?
How do I find out the chown settings for this administrator then? Should I use the nix-user web7_admin:x:10004:10007:admin:/var/www/web7 then?

The result would is:

Code:
-rwxr-xr-x 1 web7_admin web7  117 2008-07-23 17:42 hello.pl
Code:
[Wed Jul 23 20:41:49 2008] [error] [client ???.78.165.69] suexec policy violation: see suexec log for more details
[Wed Jul 23 20:41:49 2008] [error] [client ???.78.165.69] Premature end of script headers: hello.cgi

Thank you.
Susi

Last edited by Elfchen; 23rd July 2008 at 20:43.
Reply With Quote
  #4  
Old 23rd July 2008, 20:45
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 35,777
Thanks: 821
Thanked 5,332 Times in 4,184 Posts
Default

ISPConfig first steps guide:

http://www.howtoforge.com/ispconfig-2.x-first-steps-p3

Chapter 2.7.2
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 23rd July 2008, 20:51
Elfchen Elfchen is offline
Member
 
Join Date: Jun 2007
Posts: 56
Thanks: 2
Thanked 1 Time in 1 Post
Default

Think I have done in this way (see last post) - but no change - result like before - error 500

btw. the cgi-bin directory was automatically updated to new owner by ISPConfig, too:

Code:
drwxr-xr-x  2 web7_admin web7 4096 2008-07-23 17:53 cgi-bin

Last edited by Elfchen; 23rd July 2008 at 23:09. Reason: Added info
Reply With Quote
  #6  
Old 23rd July 2008, 23: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
Send a message via Skype™ to Hans
Default

"Premature end of script" errors often has to do with wrong ownership or wrong permissions.

If the administrator of your site is web7_admin and your webnumber is web7, you can set the right settings for the script by executing:

chown -R -v -f web7_admin:web7 scriptname

Where scriptname is your real scritname.
Make sure that "CGI-scripts" are allowed for the site.
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005
Reply With Quote
  #7  
Old 23rd July 2008, 23:37
Elfchen Elfchen is offline
Member
 
Join Date: Jun 2007
Posts: 56
Thanks: 2
Thanked 1 Time in 1 Post
 
Smile Solved

Thanks. This was the correct solution.

Code:
chown -R -v -f web7_admin:web7 hello.cgi
Eigentümer von hello.cgi in web7_admin:web7 geändert
So the solution is quite easy:

1. Create an admin user (ISPConfig web-settings: User & email)
2. All rights are changed to the new admin user by ISPConfig
3. Files where you have changed rights are not automatically changed - it need to be done manually
4. All works!

Thanks to both for fast reply and correct answers!

Susi
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
Sql ledger using forum.. yurtboy1 General 19 25th December 2010 21:08
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
Autoresponder installation problem cgi script won't run MikeM Installation/Configuration 8 14th September 2007 17:52
Perl and cgi script installation linuxuser1 General 30 26th April 2006 23:09
Internal Server Error 500 cgi script mphayesuk General 6 8th February 2006 22:53


All times are GMT +2. The time now is 13:00.


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