PHP not working in ISPConfig website

Discussion in 'Installation/Configuration' started by FadeOUT, Apr 25, 2007.

  1. FadeOUT

    FadeOUT New Member

    Hi,

    Sorry, I know this has come up before, but I've been searching for hours and I've yet to come up with a solution.

    I have installed ISPConfig on a openSuse 10.2 server using Falko's Perfect Setup (Thanks, Falko) and all is well - apart from PHP; If I check the PHP Scripts box on the control panel it makes no difference. Trying to open a PHP page in Firebox just gives me:

    You have chosen to open
    Which is a: application/x-httpd-php

    ...In other words it looks like PHP pages aren't being parsed.

    Any ideas :confused:
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Is the PHP file located in the website directory that ISPConfig created for the website?
     
  3. FadeOUT

    FadeOUT New Member

    Hi, thanks for replying...

    I believe so; for instance /srv/www/web1/web/myfile.php
     
  4. falko

    falko Super Moderator Howtoforge Staff

    Is PHP enabled in the vhost configuration of that web site in the file Vhosts_ispconfig.conf?
     
  5. FadeOUT

    FadeOUT New Member

    I think so..!

    ######################################
    # Vhost: www.mydomain.com:80
    ######################################
    #
    #
    <VirtualHost ***.my.ip.***:80>
    ServerName www.mydomain.com:80
    ServerAdmin [email protected]
    DocumentRoot /srv/www/web3/web
    ServerAlias mydomain.com www.mydomain.co.uk mydomain.co.uk
    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
    ErrorLog /srv/www/web3/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
    Alias /error/ "/srv/www/web3/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 ^/~([^/]+)(/(.*))? /srv/www/web3/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /srv/www/web3/user/$1/web/$3
    </VirtualHost>
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Are there any error messages in Apache's error log?
     
  7. FadeOUT

    FadeOUT New Member

    Mmm... It's packed with:

    [error] an unknown filter was not added: PHP


    (And that's it)
     
    Last edited: Apr 27, 2007
  8. FadeOUT

    FadeOUT New Member

    Mmm... Have I been caught with that AddHandler / AddType thing, I wonder?

    I should have used something other than SUSE, shouldn't I? Trouble is, a handful of friends are already using the thing, so I hope I don't have to start from scratch...

    (I was thinking for a moment I was using a 64 bit machine here, but it is just a 32 bit box, in this case).
     
    Last edited: Apr 27, 2007
  9. FadeOUT

    FadeOUT New Member

    If I try turning php on and off in a website, I get the following in the apache2 error log:

    [Fri Apr 27 14:10:02 2007] [warn] long lost child came home! (pid 16154)
    [Fri Apr 27 14:10:49 2007] [notice] Graceful restart requested, doing restart
    [Fri Apr 27 14:10:49 2007] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
    [Fri Apr 27 14:10:51 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations
     
  10. Grizzly

    Grizzly New Member

    Same error this side

    any ideas on what to do to resolve this issue
     
  11. Hans

    Hans Moderator Moderator

    Do you have this line at the end within your /etc/apache2/apache2.conf:

    Include /etc/apache2/vhosts/Vhosts_ispconfig.conf


    Do you have these lines within /etc/apache2/mods-available/dir.conf:


    <IfModule mod_dir.c>

    DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

    </IfModule>


    Make sure that you've commented out the mime-types within /etc/mime.types like this:


    #application/x-httpd-php phtml pht php
    #application/x-httpd-php-source phps
    #application/x-httpd-php3 php3
    #application/x-httpd-php3-preprocessed php3p
    #application/x-httpd-php4 php4


    After any modification restart Apache2:

    /etc/init.d/apache2 restart
     
    Last edited: Apr 28, 2007
  12. FadeOUT

    FadeOUT New Member

    Well, it is at the end of httpd.conf

    I don't have that file, either; isn't this taken care of in /etc/sysconfig/apache2 in Suse?

    I do have the line:

    APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 rewrite"

    As, I believe, specified in The Perfect Setup.

    I've commented out the following in mime.types:
    #application/x-perl pl pm al perl
    #application/x-php php php3 php4

    I've not changed anything, this time, unfortunately - but thanks for your efforts. :eek:
     
  13. FadeOUT

    FadeOUT New Member

    Mmm... I think perhaps I'm getting somewhere; PHP works if I manually change the following in the /etc/apache2/vhosts/Vhosts_ispconfig.conf file:

    AddHandler application/x-httpd-php .php .php3 .php4 .php5

    to

    AddType application/x-httpd-php .php .php3 .php4 .php5

    So, it is the AddHandler / AddType problem. I'll just try and find the right place to change this within the ISPconfig files...
     
  14. FadeOUT

    FadeOUT New Member

    OK... I've changed AddType back to AddHandler and PHP is still working. It must have been down to something else. Now I'm really confused, but at least PHP is working. I have a horrible feeling that I'll be back here begging for more help... Thanks everyone who had a go..!
     
    Last edited: Apr 28, 2007
  15. falko

    falko Super Moderator Howtoforge Staff

  16. lcerny

    lcerny New Member

    In my opensuse 10.2 fresh install was following in /etc/apache2/conf.d/php5.conf file


    <IfModule mod_php5.c>
    AddHandler ## ispconfig install ## application/x-httpd-php .php4
    AddHandler ## ispconfig install ## application/x-httpd-php .php5
    AddHandler ## ispconfig install ## application/x-httpd-php .php
    AddHandler ## ispconfig install ## application/x-httpd-php-source .php4s
    AddHandler ## ispconfig install ## application/x-httpd-php-source .php5s
    AddHandler ## ispconfig install ## application/x-httpd-php-source .phps
    DirectoryIndex index.php4
    DirectoryIndex index.php5
    DirectoryIndex index.php
    </IfModule>

    When removed this strange ## ispconfig install ##, php works fine. Seems some bug during installation ?
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    No, that was ok. Please add the comments again or you will not be able to configure PHP in ISPConfig.

    Have you enabled the php checkbox in ISPConfig for this website?
     
  18. Grizzly

    Grizzly New Member

    php still not opening opensuse10.2 Ispconfig

    log in /var/log/apache2/error_log reads



    May 02 18:02:05 2007] [error] [client ::1] client denied by server configuration: /srv/www/
    [Wed May 02 18:02:06 2007] [error] [client ::1] client denied by server configuration: /srv/www/
    [Wed May 02 18:02:07 2007] [error] [client ::1] client denied by server configuration: /srv/www/
    [Wed May 02 18:02:08 2007] [error] [client ::1] client denied by server configuration: /srv/www/
     
  19. falko

    falko Super Moderator Howtoforge Staff

    What does /etc/apache2/conf.d/php5.conf look like now?
     
  20. Grizzly

    Grizzly New Member

    /etc/apache2/conf.d/php5.conf

    <IfModule mod_php5.c>
    AddHandler ##ISPConfig INSTALL## application/x-httpd-php .php4
    AddHandler ##ISPConfig INSTALL## application/x-httpd-php .php5
    AddHandler ##ISPConfig INSTALL## application/x-httpd-php .php
    AddHandler ##ISPConfig INSTALL## application/x-httpd-php-source .php4s
    AddHandler ##ISPConfig INSTALL## application/x-httpd-php-source .php5s
    AddHandler ##ISPConfig INSTALL## application/x-httpd-php-source .phps
    DirectoryIndex index.php4
    DirectoryIndex index.php5
    DirectoryIndex index.php
    </IfModule>
     

Share This Page