ispCP - Board - Support - VHCS fork

Full Version: CGI does not work [solved]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi folks,

I tried all to get CGI working, but no go so far:
http://spamsuxx.de/cgi-bin/test.cgi

Could anyone help me out?

CGI is enabled.[/code]
I even tried to add the following to
/etc/apache2/ispcp/spamsuxx.de.conf but after a apache restart... no go..
( Options +ExecCGI wit and without the +)
Code:
<Directory /var/www/virtual/spamsuxx.de/cgi-bin>
        AllowOverride None
        Options +ExecCGI
        Order allow,deny
        Allow from all
    </Directory>

/var/www/virtual/spamsuxx.de/cgi-bin/test.cgi
Code:
#!/usr/bin/perl -w

print "Content-type: text/html\n\n";
print "<html><head>";
print "<title>CGI Test</title>";
print "</head>";
print "<body><h1>CGI is working!</h1>";
print "</body></html>";

Error log:
Code:
[Fri Apr 25 21:06:14 2008] [error] [client 77.184.196.236] Premature end of script headers: test.cgi

vhost config:
Code:
# httpd [spamsuxx.de] dmn entry BEGIN.
<VirtualHost 78.47.73.50:80>

    <IfModule suexec_module>
           SuexecUserGroup vu2001 vu2001
    </IfModule>

    ServerAdmin     webmaster@spamsuxx.de
    DocumentRoot    /var/www/virtual/spamsuxx.de/htdocs

    ServerName      spamsuxx.de
    ServerAlias     www.spamsuxx.de spamsuxx.de *.spamsuxx.de

    ErrorLog        /var/log/apache2/users/spamsuxx.de-error.log
    TransferLog     /var/log/apache2/users/spamsuxx.de-access.log

    CustomLog       /var/log/apache2/spamsuxx.de-traf.log traff
    CustomLog       /var/log/apache2/spamsuxx.de-combined.log combined

    Alias /errors   /var/www/virtual/spamsuxx.de/errors/

    RedirectMatch permanent /ftp([\/]?)         http://ispcp.spamsuxx.de/ftp/
    RedirectMatch permanent /pma([\/]?)         http://ispcp.spamsuxx.de/pma/
    RedirectMatch permanent /webmail([\/]?)     http://ispcp.spamsuxx.de/webmail/

    ErrorDocument 401 /errors/401.html
    ErrorDocument 403 /errors/403.html
    ErrorDocument 404 /errors/404.html
    ErrorDocument 500 /errors/500.html
    ErrorDocument 503 /errors/503.html

    <IfModule mod_cband.c>
        CBandUser spamsuxx.de
    </IfModule>

    # httpd awstats support BEGIN.

   ProxyRequests Off

   <Proxy *>
      Order deny,allow
      Allow from all
   </Proxy>

   ProxyPass                    /stats  http://localhost/stats/spamsuxx.de
   ProxyPassReverse     /stats  http://localhost/stats/spamsuxx.de
   # httpd awstats support END.

    # httpd dmn entry cgi support BEGIN.
    ScriptAlias /cgi-bin/ /var/www/virtual/spamsuxx.de/cgi-bin/
    <Directory /var/www/virtual/spamsuxx.de/cgi-bin>
        AllowOverride None
        #Options ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
    # httpd dmn entry cgi support END.
    # httpd dmn entry PHP2 support BEGIN.
    <IfModule mod_php4.c>
        php_admin_value open_basedir "/var/www/virtual/spamsuxx.de:/var/www/virtual/spamsuxx.de/phptmp:/usr/share/php"
        php_admin_value upload_tmp_dir "/var/www/virtual/spamsuxx.de/phptmp"
        php_admin_value session.save_path "/var/www/virtual/spamsuxx.de/phptmp"
        php_admin_value sendmail_path '/usr/sbin/sendmail -f vu2001 -t -i'
    </IfModule>
    <IfModule mod_php5.c>
        php_admin_value open_basedir "/var/www/virtual/spamsuxx.de:/var/www/virtual/spamsuxx.de/phptmp:/usr/share/php"
        php_admin_value upload_tmp_dir "/var/www/virtual/spamsuxx.de/phptmp"
        php_admin_value session.save_path "/var/www/virtual/spamsuxx.de/phptmp"
        php_admin_value sendmail_path '/usr/sbin/sendmail -f vu2001 -t -i'
    </IfModule>
    <IfModule mod_fastcgi.c>
        ScriptAlias /php4/ /var/www/fcgi/spamsuxx.de/
        ScriptAlias /php5/ /var/www/fcgi/spamsuxx.de/
        <Directory "/var/www/fcgi/spamsuxx.de">
            AllowOverride None
            Options +ExecCGI -MultiViews -Indexes
            Order allow,deny
            Allow from all
        </Directory>
    </IfModule>
    # httpd dmn entry PHP2 support END.

    <Directory /var/www/virtual/spamsuxx.de/htdocs>
        # httpd dmn entry PHP support BEGIN.
        # httpd dmn entry PHP support END.
        Options -Indexes Includes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    Include /etc/apache2/ispcp/spamsuxx.de.conf

</VirtualHost>
# httpd [spamsuxx.de] dmn entry END.
The "premature end of script" is typical.

Do you have a mac or windows on the client where you upload the file?
have you tried uploading with FTP ASCII mode?
Nope, no upload, i wrote the script "de novo" on the server, so there is no issue with bin/ASCII upload. The permissions are, for testing purpose, set to 777 on the script.

On the client side I am using Linux.

Neither new written scripts nore downloaded scripts do work
hmm maybe perl is not allowed in openbase path ?
openbase = php != perl

I also have had some problems with perl cgis - the permissions must be set correctly and the newline has to be correct. But I don't know what exactly the rules were (somewhere in the forum but I fear it was before September 07 - so it's gone).

/J
well for me there were three problems i can remember... Script must be executable, Script must belong to the correct user and group (vu2xxx/vu2xxx) and the path to the interpreter in the shebang has to be correct.

With these three conditions met I never had any problems...
rbtux Wrote:well for me there were three problems i can remember... Script must be executable, Script must belong to the correct user and group (vu2xxx/vu2xxx) and the path to the interpreter in the shebang has to be correct.

With these three conditions met I never had any problems...

I will check this and see what is happening

Sory for the my late reply.
Okay, the permissions had to be 755 (777 does not work, thats fine!)

Thanks for your help!
Reference URL's