2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-PHP.ps1
|
|
|
|
|
## Desc: Install PHP
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Install latest PHP in chocolatey
|
|
|
|
|
$installDir = "c:\tools\php"
|
2021-11-16 11:32:09 +03:00
|
|
|
$phpMajorMinor = (Get-ToolsetContent).php.version
|
2023-11-22 15:14:08 +01:00
|
|
|
$phpVersionToInstall = Resolve-ChocoPackageVersion -PackageName "php" -TargetVersion $phpMajorMinor
|
|
|
|
|
Install-ChocoPackage php -ArgumentList "--params", "/InstallDir:$installDir", "--version=$phpVersionToInstall"
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2020-03-20 01:14:49 -07:00
|
|
|
# Install latest Composer in chocolatey
|
2023-11-22 15:14:08 +01:00
|
|
|
Install-ChocoPackage composer -ArgumentList "--install-args", "/DEV=$installDir /PHP=$installDir"
|
2020-03-20 01:14:49 -07:00
|
|
|
|
|
|
|
|
# update path to extensions and enable curl and mbstring extensions, and enable php openssl extensions.
|
2021-01-15 09:35:36 +03:00
|
|
|
((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
|
2019-12-13 09:48:00 -05:00
|
|
|
|
|
|
|
|
# Set the PHPROOT environment variable.
|
2023-11-17 13:52:52 +01:00
|
|
|
[Environment]::SetEnvironmentVariable("PHPROOT", $installDir, "Machine")
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2020-07-17 15:29:03 +07:00
|
|
|
# Invoke Pester Tests
|
|
|
|
|
Invoke-PesterTests -TestFile "PHP"
|