suPHP 0.7.1 and Ubuntu Server 10.04

Discussion in 'Server Operation' started by brwarner, Jun 13, 2010.

  1. brwarner

    brwarner New Member

    I recently installed Ubuntu Server 10.04 as a LAMP server, and want to install suPHP to manage multiple virtual hosts. PHP was working fine before, but now when I try with suPHP it keeps giving internal server errors. Here is the error I'm getting in the Apache logs:

    Code:
    [Sun Jun 13 09:35:42 2010] [error] [client 70.29.83.166] Premature end of script headers: test.php, referer: http://brwarner.co.cc/
    No other errors are above or below which indicate the exact problem, and the suphp.log is empty.

    I installed suPHP using the following commands
    Code:
    ./configure --with-apache-user=www-data --with-apxs=/usr/bin/apxs2
    make
    make install
    Here is my suphp.conf found in /usr/local/etc
    Code:
    [global]
    ;Path to logfile
    logfile=/var/log/suphp.log
    
    ;Loglevel
    loglevel=info
    
    ;User Apache is running as
    webserver_user=www-data
    
    ;Path all scripts have to be in
    docroot=/var/www:${HOME}/public_html
    
    ;Path to chroot() to before executing script
    ;chroot=/mychroot
    
    ; Security options
    allow_file_group_writeable=false
    allow_file_others_writeable=false
    allow_directory_group_writeable=false
    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=true
    
    ;PATH environment variable
    env_path=/bin:/usr/bin
    
    ;Umask to set, specify in octal notation
    umask=0077
    
    ; Minimum UID
    min_uid=100
    
    ; Minimum GID
    min_gid=100
    
    
    [handlers]
    ;Handler for php-scripts
    application/x-httpd-php="php:/usr/bin/php5"
    
    ;Handler for CGI-scripts
    x-suphp-cgi="execute:!self"
    
    And the virtual host file
    Code:
    <VirtualHost *:80>
            ServerAdmin REMOVED
            ServerName REMOVED
            ServerAlias REMOVED
    
            php_admin_value engine off
            AddType application/x-httpd-php .php
            AddHandler application/x-httpd-php .php
            suPHP_Engine on
            suPHP_AddHandler application/x-httpd-php
            suPHP_UserGroup brwarner brwarner
            suPHP_PHPPath /usr/bin
    
            DocumentRoot /home/brwarner/public_html
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /home/brwarner/public_html>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    
     
  2. falko

    falko Super Moderator ISPConfig Developer

    What's the output of
    Code:
    updatedb
    locate suphp.conf
    ?
     
  3. brwarner

    brwarner New Member

    Code:
    /home/brwarner/suphp-0.7.1/doc/suphp.conf-example
    /usr/local/etc/suphp.conf
    
     
    Last edited: Jun 14, 2010
  4. falko

    falko Super Moderator ISPConfig Developer

    Can you try
    Code:
    cp /usr/local/etc/suphp.conf /etc/suphp.conf
    /etc/init.d/apache2 restart
    ?
     
  5. brwarner

    brwarner New Member

    Still get this:
    Code:
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    
    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    
    More information about this error may be available in the server error log.
    
    Last few entries in error.log
    Code:
    [Tue Jun 15 15:14:39 2010] [notice] caught SIGTERM, shutting down
    [Tue Jun 15 15:14:40 2010] [notice] Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.2 with Suhosin-Patch configured -- resuming normal operations
    [Tue Jun 15 15:14:47 2010] [error] [client 173.32.13.23] File does not exist: /home/brwarner/public_html/favicon.ico
    [Tue Jun 15 15:14:48 2010] [error] [client 173.32.13.23] Premature end of script headers: test.php, referer: http://brwarner.co.cc/
    [Tue Jun 15 15:14:48 2010] [error] [client 173.32.13.23] File does not exist: /home/brwarner/public_html/favicon.ico
    
    I'm pretty sure it was in the right place before, because I had it in /etc but then it gave me an error saying it couldn't open it. I moved it to /usr/local/etc and then it started doing this, but no explanation...
    :(
     
  6. falko

    falko Super Moderator ISPConfig Developer

    Is your PHP script owned by the correct user and group (brwarner)?
     
  7. brwarner

    brwarner New Member

    Yes, as well as all parent folders up to the brwarner home directory (and all have full read access despite)
     
  8. brwarner

    brwarner New Member

    I have found the issue! (Finally)
    Turns out the line
    Code:
    application/x-httpd-php="php:/usr/bin/php5"
    
    in suphp.conf should read
    Code:
    application/x-httpd-php="php:/usr/bin/php5-cgi"
    
    as that executable echos the necessary headers as well. Now things work :)
     

Share This Page