Files
runner-images/images/win/scripts/Installers/Install-PHP.ps1
Leonid Lapshin 8079b61569 openssl php extension fix (#2444)
Co-authored-by: Leonid Lapshin <originalnoe-nazvanie@yandex.ru>
2021-01-15 09:35:36 +03:00

21 lines
1.0 KiB
PowerShell

################################################################################
## File: Install-PHP.ps1
## Desc: Install PHP
################################################################################
# Install latest PHP in chocolatey
$installDir = "c:\tools\php"
Choco-Install -PackageName php -ArgumentList "--force", "--params", "/InstallDir:$installDir"
# Install latest Composer in chocolatey
Choco-Install -PackageName composer -ArgumentList "--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=openssl','extension=openssl') | Set-Content -Path $installDir\php.ini
# Set the PHPROOT environment variable.
setx PHPROOT $installDir /M
# Invoke Pester Tests
Invoke-PesterTests -TestFile "PHP"