This question already has an answer here:

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"

marked as duplicate by HopelessN00b Feb 25 '15 at 7:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.

  • Well, I didn't know that. Thank you. – user34295 Oct 4 '12 at 5:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.