Added new site, PHP not working

Discussion in 'Installation/Configuration' started by spuppy, Aug 27, 2008.

  1. spuppy

    spuppy New Member

    You just said that apache 1.x is installed in addition to 2.x. So which is it? Is my server running one? both?

    I still don't get how both get installed and only one works. Or it works for some people but not everyone... I am really lost here. I think maybe the instructions are incorrect or something.
     
  2. spuppy

    spuppy New Member

    Is there a CentOS equivalent of the command a2enmod php5?
     
  3. spuppy

    spuppy New Member

    I just checked everything, and apache and php are all installed fine. So something is wrong with ISPConfig, not the server. Can someone help?
     
  4. spuppy

    spuppy New Member

    Does anyone know which config file ISPConfig uses to control whether PHP is enabled on a particular site? If it's not the main php.conf file or httpd.conf, then what is it?
     
  5. spuppy

    spuppy New Member

    Hi, I found the file you were thinking of. It is not Vhost_ispconfig.conf, but rather Vhosts_ispconfig.conf

    If you are still willing to help, here are the contents of one of the sites for that file:

    Code:
    ######################################
    # Vhost: www.k-rad.hk:80
    ######################################
    #
    #
    <VirtualHost 64.40.112.137:80>
    ServerName www.k-rad.hk:80
    ServerAdmin webmaster@k-rad.hk
    DocumentRoot /var/www/web4/web
    ServerAlias k-rad.hk
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 $
    ErrorLog /var/www/web4/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
    <IfModule mod_ruby.c>
      <Directory /var/www/web4/web>
        Options +ExecCGI
      </Directory>
      RubyRequire apache/ruby-run
      #RubySafeLevel 0
      <Files *.rb>
        SetHandler ruby-object
        RubyHandler Apache::RubyRun.instance
      </Files>
      <Files *.rbx>
        SetHandler ruby-object
        RubyHandler Apache::RubyRun.instance
      </Files>
    </IfModule>
    Alias /error/ "/var/www/web4/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/web4/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web4/user/$1/web/$3
    <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
      RewriteRule .* - [F]
    </IfModule>
    </VirtualHost>
    #
    #
    #
    
    When I try disabling PHP completely, it no longer shows a download dialog. Instead, apache serves a blank page (looking at the code, you can see the unparsed file still).

    So Apache is working, i think it's just php that's broken. How should I go about fixing it?
     
    Last edited: Aug 28, 2008
  6. spuppy

    spuppy New Member

    OK after expirementing ALL DAY I finally found a solution. I have no idea why, but this is what I did

    I changed the following

    Code:
    <Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    
    To

    Code:
    <Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
        SetHandler php5-script
    </Files>
    
    Can someone come up with a theory on why this is? And how can I get it to show up on all the vhosts without having to do this manually every time I add or edit a site?
     
  7. till

    till Super Moderator

    Thats no bug, so there is nothing to be fixed. You missed to tell us that you use OpenSuSE. OpenSuSE does not understand the apache directives that all other linux distributions use to activate php, so you have to set this in the configuration. Please have a look here, it is all explained in the first steps guide, I guess you skipped this manual as you configured your server:

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

    spuppy New Member

    You'll note that I deleted the "fix" that I thought I found. That wasn't a fix, and thus I deleted the last reply.

    I am NOT using OpenSuSE. I am using CentOS 5.2, as I originally stated. I followed the directions exactly, and it is broken.

    The only way to fix it is to manually edit the Vhosts_ispconfig.conf file and make the changes I made above.

    Can you explain this bug? How does this fix it? And how can I make it so that line is always added, so I can have PHP working on all the new sites I add?
     
  9. falko

    falko Super Moderator

  10. spuppy

    spuppy New Member

    I had it set to 'addtype' before, and I thought that was the solution. Turns out I was wrong, which is why I deleted the reply I posted (the one that you replied to earlier). Currently the only way I can get it working is to manually add SetHandler php5-script in between the <Files *.php> tags.

    If you can figure out why, then great. It will benefit everyone else with similar problems running CentOS 5.2. If you want, I can try some other things with my server to help you figure out what is going on. Just let me know.
     
  11. falko

    falko Super Moderator

    What happens when you remove the whole <Files *.php>... stuf from your vhosts and restart Apache? Does PHP work then?
     
  12. spuppy

    spuppy New Member

    No.

    And I just added a new site, and it worked without requiring the modified line. But two of my sites that didn't work got reverted (the line got deleted), so it stopped working again. The other 3 or 4 sites work fine without the line added.
     
    Last edited: Sep 2, 2008

Share This Page