Trying to get PHP and PHP5 work with Apache2

Discussion in 'Server Operation' started by talwar_, Mar 26, 2007.

  1. talwar_

    talwar_ New Member

    Plz excuse the thread title.. i said "php and php5" instead of "php4 and php5"!

    I recently followed the howtoforge article on setting up php4 and php5 on Sarge. (http://www.howtoforge.com/apache2_with_php5_and_php4)

    Everything seemed to work during the setup except that i couldnt install all the packages - it could not find some (e.g. php5-pdo-mysql). anyway, i carried on with the instructions and this is my problem:

    .php files are correctly being handled by the apache2 handler, i have verified this by using the phpinfo() function. However when i try to browse a .php4 extension i get "object not found" (HTTP 404)

    it is as though apache2 doesnt know what to do with .php4 files, even though i have added the following lines to apache2.conf:

    AddHandler php-script .php4
    Action php-script /cgi-bin/php4

    heres what i have currently installed for php4 and php5:

    ~# apt-show-versions | grep php
    php4-cgi/sarge uptodate 4:4.4.6-0.dotdeb.2
    php4-pgsql/sarge uptodate 4:4.4.6-0.dotdeb.2
    php4-common/sarge uptodate 4:4.4.6-0.dotdeb.2
    libapache-mod-php5/sarge uptodate 5.2.1-0.dotdeb.1
    php5-common/sarge uptodate 5.2.1-0.dotdeb.1
    php4/sarge uptodate 4:4.4.6-0.dotdeb.2
    libapache2-mod-php5/sarge uptodate 5.2.1-0.dotdeb.1

    any suggestions? thanks in advance!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    If you have not installed the packages, the setup can not work. Please make sure that you added the lines for dotdeb to your sources list and ran

    apt-get update

    afterwards without errors.
     
  3. talwar_

    talwar_ New Member

    I had already added the dot deb sources to my sources.list before doing anything. I did also run apt-get update before updayting php4 and installing php5.

    One thing to note is that i am using virtualmin to manage virtual hosts in Apache2.

    When i tell virtualmin to make my test virtual host use CGI for PHP it uses PHP4. If i then set virtualmin to make the virtual host use apache2 mod_php i get served by PHP5.

    ive verified the above by browsing to test pages which contain calls to the phpinfo() function.

    so what i am trying to achieve is .php served by php5 via apache2 mod and .php4 served by php4 using CGI.

    Maybe I have to add the custom handlers to the individual virtual host config file?
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Which packages are missing exactly?

    Can you post your vhost configuration?
     
  5. talwar_

    talwar_ New Member

    managed to fix it up in the end! i think php4-cgi was missing. thanks for the assists!
     

Share This Page