suPHP. Premature end of s.

Discussion in 'HOWTO-Related Questions' started by Wiesemarc, Nov 14, 2006.

  1. Wiesemarc

    Wiesemarc New Member

    I have installed php4 and php5 after this http://howtoforge.com/apache2_with_php5_and_php4 howto, and now i have used the http://howtoforge.com/apache2_suphp_php4_php5 howto, an have checked the logs and all files on the server has the right permissions. But i just get "Premature end of script header: info.php", i have been searching for answers on this all day and yesterday, but nothing about this ?

    I have tried to change "x-httpd-php" in suphp.conf to /usr/bin/php4-cgi and /usr/lib/cgi-bin/php4-cgi but same error everytime.

    Hope some of you guys have seen this error before and know what it is.
     
  2. falko

    falko Super Moderator ISPConfig Developer

    What's in Apache's error log? What's the output of
    Code:
    apache2 -t
    or
    Code:
    httpd2 -t
    ?
     
  3. Wiesemarc

    Wiesemarc New Member

    apache2 -t gives:
    Syntax OK

    apache2 -v gives:
    Server version: Apache/2.0.54
    Server built: Jul 28 2006 09:04:55
    Server's Module Magic Number: 20020903:9
    Architecture: 32-bit
    Server compiled with....
    -D APACHE_MPM_DIR="server/mpm/prefork"
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_SYSVSEM_SERIALIZE
    -D APR_USE_PTHREAD_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D HTTPD_ROOT=""
    -D SUEXEC_BIN="/usr/lib/apache2/suexec2"
    -D DEFAULT_PIDLOG="/var/run/httpd.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_LOCKFILE="/var/run/accept.lock"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
    -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

    Error.log:
    [Tue Nov 14 12:58:09 2006] [error] [client x.x.x.x] Premature end of script headers: index.php
     
  4. falko

    falko Super Moderator ISPConfig Developer

    What's in that index.php file?
     
  5. Wiesemarc

    Wiesemarc New Member

    In the file index.php this is:

    <?
    phpinfo();
    ?>
     
  6. falko

    falko Super Moderator ISPConfig Developer

    What happens if you change it to
    PHP:
    <?php
    phpinfo
    ();
    ?>
    ?
     
  7. Wiesemarc

    Wiesemarc New Member

    Then i will get the same error.
    Have also tried <? echo "test; ?>, <?php echo "test; ?> <?PHP echo "test; ?> and others, but same error everytime, if i change the dir to 644 i will get the pcfg_openfile error (.htaccess)

    Don't really know what to do next.
     
  8. falko

    falko Super Moderator ISPConfig Developer

    Directories must always be executable, so you should chmod it back to 755 (or whatever it was before).

    Can you post your Apache vhost configuration here? Which PHP is your CGI version, and which an Apache module?
     
  9. Wiesemarc

    Wiesemarc New Member

    Apache Vhost Info:

    <VirtualHost *>
    DocumentRoot "/var/www/mydata/test"
    ServerName domain
    ServerAlias domain
    ServerAdmin mail
    ErrorLog /var/www/logs/admin/test.ooz.dk-error.log
    CustomLog /var/www/logs/admin/test.ooz.dk-access.log combined
    suPHP_Engine on
    suPHP_UserGroup 10000 10000
    AddHandler x-httpd-php .php .php3 .php4 .php5
    suPHP_AddHandler x-httpd-php
    <Directory /var/www/mydata/test>
    Options ExecCGI
    </Directory>
    </VirtualHost>

    Php informations.

    # php4 -v
    PHP 4.4.4-0.dotdeb.1 (cli) (built: Aug 21 2006 16:07:30)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

    # php5 -v
    PHP 5.1.6-0.dotdeb.2 (cli) (built: Aug 31 2006 17:18:42)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
     
  10. falko

    falko Super Moderator ISPConfig Developer

    What's in /etc/suphp.conf?
    In which directory is index.php located?
     
  11. Wiesemarc

    Wiesemarc New Member

    Index.php location:
    /var/www/mydata/test/index.php


    SuPHP.conf Content:

    [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=/

    ;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=false

    ;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
    x-httpd-php=php:/usr/lib/cgi-bin/php4

    ;Handler for CGI-scripts
    x-suphp-cgi4=execute:!self
     
  12. falko

    falko Super Moderator ISPConfig Developer

    Can you put this:

    Code:
    <Directory /var/www/mydata/test>
    Options ExecCGI
    </Directory>
    right at the beginning of your vhost and change it to

    Code:
    <Directory /var/www/mydata/test>
    Options +ExecCGI
    </Directory>
    ?

    What's the output of
    Code:
    /usr/lib/cgi-bin/php4 -v
    and
    Code:
    which php4
    ?
     
  13. Wiesemarc

    Wiesemarc New Member

    #/usr/lib/cgi-bin/php4 -v
    PHP 4.4.4-0.dotdeb.1 (cgi-fcgi) (built: Aug 21 2006 16:04:56)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

    # which php4
    /usr/bin/php4
     
  14. falko

    falko Super Moderator ISPConfig Developer

    Did this <Directory ...> thing help?
     
  15. raruiz

    raruiz New Member

    I had the same problem and solved reading here.
    suphp and premature end of script ....
    I found my directory permission were 777, and changed it to 755. Works fine now. Thank you.
     

Share This Page