From a4c66572ab7d009b024edc907c89cd2f8620291f Mon Sep 17 00:00:00 2001 From: Michael Mainer Date: Fri, 20 Mar 2020 01:14:49 -0700 Subject: [PATCH] Update Install-PHP.ps1 to include Composer 1. Install Composer from Chocolatey. PHP needs its dependency manager. 2. Enable php_openssl.dll - believe this is necessary in the case someone wants to update Composer. **Reference** https://chocolatey.org/packages/composer https://github.com/actions/virtual-environments/issues/587 https://superuser.com/questions/1010080/the-openssl-extension-is-missing-on-windows-while-installing-composer --- images/win/scripts/Installers/Install-PHP.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 index 02d38931..72db2ee2 100644 --- a/images/win/scripts/Installers/Install-PHP.ps1 +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -10,8 +10,11 @@ Import-Module -Name ImageHelpers $installDir = "c:\tools\php" choco install php -y --force --params "/InstallDir:$installDir" -# update path to extensions and enable curl and mbstring extensions -((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"') | Set-Content -Path $installDir\php.ini +# Install latest Composer in chocolatey +choco install composer --ia "/DEV=$installDir /PHP=$installDir" + +# update path to extensions and enable curl and mbstring extensions, and enable php openssl extensions. +((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"' -replace 'extension=";php_openssl.dll"','extension_dir = "php_openssl.dll"') | Set-Content -Path $installDir\php.ini # Set the PHPROOT environment variable. setx PHPROOT $installDir /M