Search code examples
phpdrupal-8acquia

Different directories using different PHP versions?


I have installed the Acquia Developer Desktop on Windows 7.

I need to install Lightning so I've tried to update Composer and Drupal to the latest versions so I can install Lightning correctly.

I specified PHP 5.6.19 when creating a new site in Aquia Developer Desktop.

When I try to upgrade, I get errors about PHP version. When I run php -v in the site directory, it reports as 5.4.45. When I run it in the Dev Desktop directory, it reports as 5.5.33.

I have seen a number of threads for OSX or Linux environments but I cannot match them to the Windows environment.

How can I ensure the site is running on 5.5 or later?

This is in my httpd.conf:

 <IfDefine !php_fcgi>
  <IfDefine php5_3>
    LoadModule php5_module "C:\Program Files (x86)\DevDesktop\php5_3\php5apache2_4.dll"
    PHPINIDir "C:\Program Files (x86)\DevDesktop\php5_3"
  </IfDefine>
  <IfDefine php5_4>
    LoadModule php5_module "C:\Program Files (x86)\DevDesktop\php5_4\php5apache2_4.dll"
    PHPINIDir "C:\Program Files (x86)\DevDesktop\php5_4"
  </IfDefine>
  <IfDefine php5_5>
    LoadModule php5_module "C:\Program Files (x86)\DevDesktop\php5_5\php5apache2_4.dll"
    PHPINIDir "C:\Program Files (x86)\DevDesktop\php5_5"
  </IfDefine>
  <IfDefine php5_6>
    LoadModule php5_module "C:\Program Files (x86)\DevDesktop\php5_6\php5apache2_4.dll"
    PHPINIDir "C:\Program Files (x86)\DevDesktop\php5_6"
  </IfDefine>
  <IfDefine php7_0>
    LoadModule php7_module "C:\Program Files (x86)\DevDesktop\php7_0\php7apache2_4.dll"
    PHPINIDir "C:\Program Files (x86)\DevDesktop\php7_0"
  </IfDefine>
</IfDefine>

Solution

  • When you look at IfDefine

    The parameter-name argument is a define as given on the httpd command line via -Dparameter at the time the server was started or by the Define directive.

    So, you can either start Apache with an additional command line argument

    -Dphp5_5
    

    or insert a Define directive before the given section

    Define php5_5
    

    The same, if you want to use PHP 5.6 (php5_6) or 7.0 (php7_0).