Take the 2-minute tour ×

I need both PHP 5.4.7 and 5.3.17 running on Windows 7 x64 with Apache 2.2.23. This is my virtual host configuration:

<VirtualHost *:80>
    DocumentRoot  "C:/WAMP/Apache/htdocs/php54"
    ServerName php54.local
    PHPIniDir "C:/WAMP/PHP54"
    LoadModule php5_module "C:/WAMP/PHP54/php5apache2_2.dll"
    php_value extension_dir "C:/WAMP/PHP54/ext"

    <Directory "C:/WAMP/Apache/htdocs/php54">
        Order allow,deny
        Allow from all

The PHPIniDir and LoadModule directives work fine and using phpinfo() inside my script prints the right PHP version.

But I need to load extensions, and this is where it fails. php_value extension_dir should be C:/WAMP/PHP54/ext but it's (default one) C:/php.

What I'm missing here?

EDIT: Of course I can set this value directly in C:/WAMP/PHP54/php.ini, but I prefer passing it using vhost configuration:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "C:/WAMP/PHP54/ext"
share|improve this question

1 Answer 1

up vote 2 down vote accepted

There are a couple of things that are off here.

Running two versions of PHP simultaneously under the same Apache process is usually done via CGI. But you seem to be trying to load PHP as an Apache module (why is that LoadModule line in a VirtualHost)?

php_value, and related directives, only work when PHP is run as an Apache module (not under CGI). So if you are instead running PHP under CGI, only php.ini values will work.

share|improve this answer
Well, I didn't know that. Thank you. –  user34295 Oct 4 '12 at 5:53

Your Answer


