LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-10-2009, 03:51 AM   #1
npardoe
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
Different PHP versions per Apache virtual host


Hi all,

I'm running XAMPP 1.7.2 on Ubuntu 8.10 (Linux dt19.im.local 2.6.27-14-generic #1 SMP Tue Aug 18 16:25:45 UTC 2009 i686 GNU/Linux) and am using the PHP 5.3.0 Apache module as standard. For one virtual host I'd like to use PHP 5.2.X as it is part of a project which has a lot of legacy code which is not compatible with PHP 5.3.0. The virtual host configuration block and the applicable directory directive are as follows -

Code:
<VirtualHost 127.0.0.1:80 192.168.1.28:80>
    ServerAdmin [SNIP]
    DocumentRoot htdocs/[SNIP]/[SNIP]
    ServerName [SNIP].localhost
    ServerAlias www.[SNIP].localhost
    ErrorLog logs/[SNIP]-error_log
    CustomLog logs/[SNIP]-access_log common
    # Must use PHP <5.3.0 (5.2.6 in production use)
    # PHP 5.3.0 MySQL library drops support for <MySQL 4.1 password hashes which are used by the [SNIP] database
    Action application/x-httpd-php "cgi-bin/php-5.2.6 -c /opt/lampp/etc/php.ini-pre1.7.2"
    AddHandler application/x-httpd-php .php
</VirtualHost>

# Permissions required here even though cgi-bin has the +FollowSymLinks option set
# FollowSymLinks doesn't change the pathname matched against <Directory> sections
# See http://httpd.apache.org/docs/2.0/mod/core.html#options
<Directory /opt/lampp/bin>
  AllowOverride None
  Options +ExecCGI

  <Files php-5.2.6>
    Order allow,deny
    Allow from all
  </Files>
</Directory>
Checking phpinfo() output on the above virtual host (or using the default virtual host directive and accessing it via http://localhost/[SNIP]/[SNIP]/phpinfo.php rather than http://[SNIP].localhost/phpinfo.php) shows PHP 5.3.0 is running. After applying minor tweaks such as adding ScriptAlias or SetEnv options the problem persists. I've Googled for a good while and have checked the permissions and the like and tried the advice of other users (XAMPP or otherwise) either resulting in PHP 5.3.0 being used or a HTTP 400 bad request/invalid URI error. I've stuck with the configuration above as this is correct according to the PHP manual.
FYI cgi-bin/php-5.2.6 is a soft symbolic link to /opt/lampp/bin/php-5.2.6 (I've added the FollowSymLinks option to the cgi-bin directory directive in httpd.conf). I've tried installing php5-cgi from the Ubuntu repos and setting it up in a similar way, to no avail. I've also tried copying the executables into the cgi-bin directory, pointing the Action line directly to bin/php-5.2.6 and dropping the -c /opt/lampp/etc/php.ini-pre1.7.2 option in the Action line. I've even tried commenting out the LoadModule lines for PHP which results in a HTTP 400 bad request/invalid URI error. This demonstrates the fact that the PHP CGI use is being ignored.

Any help or pointers would be appreciated. I've checked httpd.conf and the extra/httpd-*.conf files and ensured all required includes are being loaded. I know that it's probably something stupid on my part which is causing this! Given that I've tried PHP CGI builds in the Ubuntu repos I don't think this is an XAMPP-specific issue.

Thanks in advance for the assistance
 
Old 10-01-2009, 06:25 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
This all are just guesses but maybe something will work out.

First thing I saw is that the apache docs has the action Addhandler type the other way around.

Code:
# Files of a particular file extension
AddHandler my-file-type .xyz
Action my-file-type /cgi-bin/program.cgi
Also I don't think this really matters. But might be worth a try.
Nother thing is that your using relative pathes. The doc says something about a virtualargument to the Action Option. This ignores if the file to be used as the Action does not exist.
Maybe try with absolute path.

Next is that you already have the Handle for the application/x-httpd-php extension. Maybe first remove it with RemoveHandler? Then create it.
Nother thing to bypass possible handler problem is to use a diffrent extension on the files. something like .php2.6. Also this would sure need a rename of a lot of files but might be worth a try with just the index.php2.6 file (dunno if two dots are allowed inside extension...)

Check out this link this should give the final answer.
http://www.php.net/manual/en/install...che2.php#92797
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i see apache, mysql, php versions? epamuk Linux - Server 1 01-04-2009 04:55 PM
sles 9 and apache/php versions scabrous1 SUSE / openSUSE 1 11-16-2005 09:30 AM
ES 4 Apache and PHP versions? bgriffin21 Red Hat 1 04-09-2005 10:51 AM
Controlling Apache and PHP versions/deps merana Debian 0 01-03-2005 01:52 PM
Apache, PHP, MySQL versions? subnet_rx Linux - General 3 06-26-2004 01:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration