mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-28 17:43:50 +07:00
Fix xdebug and pcov on PHP7.4 and restructre code
This commit is contained in:
41
src/scripts/win32.ps1
Normal file
41
src/scripts/win32.ps1
Normal file
@ -0,0 +1,41 @@
|
||||
param (
|
||||
[Parameter(Mandatory=$true)][string]$version = "7.3"
|
||||
)
|
||||
|
||||
if($version -eq '7.4') {
|
||||
$version = '7.4RC'
|
||||
}
|
||||
|
||||
echo "Installing PhpManager"
|
||||
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
||||
|
||||
$installed = $($(php -v)[0] -join '')[4..6] -join ''
|
||||
if($installed -ne $version) {
|
||||
if($version -lt '7.0') {
|
||||
echo "Installing VcRedist"
|
||||
Install-Module -Name VcRedist -Force
|
||||
}
|
||||
echo "Installing PHP"
|
||||
Uninstall-Php C:\tools\php
|
||||
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -InstallVC -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production -Force
|
||||
echo "Switch PHP"
|
||||
(Get-PhpSwitcher).targets
|
||||
Initialize-PhpSwitcher -Alias C:\tools\php -Scope CurrentUser -Force
|
||||
Add-PhpToSwitcher -Name $version -Path C:\tools\php$version -Force
|
||||
Switch-Php $version -Force
|
||||
}
|
||||
|
||||
echo "Housekeeping in PHP.ini, enabling openssl"
|
||||
Add-Content C:\tools\php\php.ini "date.timezone = 'UTC'"
|
||||
Set-PhpIniKey extension_dir C:\tools\php\ext
|
||||
if($version -lt '7.4') {
|
||||
Enable-PhpExtension openssl
|
||||
} else {
|
||||
Add-Content C:\tools\php\php.ini "extension=php_openssl.dll"
|
||||
}
|
||||
|
||||
echo "Installing Composer"
|
||||
Install-Composer -Scope System -Path C:\tools\php
|
||||
$ext_dir = Get-PhpIniKey extension_dir
|
||||
php -v
|
||||
composer -V
|
Reference in New Issue
Block a user