Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.
; extension_dir = "./"
; On windows:
extension_dir = "C:/WAMP/PHP54/ext"
share|improve this question

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.

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

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