mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Add support for specifying nts/ts builds on windows
This commit is contained in:
		| @ -156,7 +156,11 @@ $php_dir = 'C:\tools\php' | ||||
| $ext_dir = $php_dir + '\ext' | ||||
| $ProgressPreference = 'SilentlyContinue' | ||||
| $master_version = '8.0' | ||||
| $arch='x64' | ||||
| $arch = 'x64' | ||||
| $ts = $false | ||||
| if((Test-Path env:PHPTS) -and $env:PHPTS -eq 'ts') { | ||||
|   $ts = $true | ||||
| } | ||||
|  | ||||
| Step-Log "Setup PhpManager" | ||||
| Install-Module -Name PhpManager -Force -Scope CurrentUser | ||||
| @ -172,7 +176,7 @@ if (Test-Path -LiteralPath $php_dir -PathType Container) { | ||||
| } | ||||
| Step-Log "Setup PHP" | ||||
| $status = "Installed" | ||||
| if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.')))) { | ||||
| if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version -replace '^(\d+(\.\d+)*).*', '$1.'))) -or $ts -ne $installed.ThreadSafe) { | ||||
|   if ($version -lt '7.0') { | ||||
|     Install-Module -Name VcRedist -Force | ||||
|     $arch='x86' | ||||
| @ -181,7 +185,7 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version | ||||
|     $version = 'master' | ||||
|   } | ||||
|  | ||||
|   Install-Php -Version $version -Architecture $arch -ThreadSafe $true -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1 | ||||
|   Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force >$null 2>&1 | ||||
| } else { | ||||
|   $updated = Update-Php $php_dir >$null 2>&1 | ||||
|   if($updated -eq $False) { | ||||
| @ -194,7 +198,11 @@ Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir | ||||
| Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir | ||||
| Update-PhpCAInfo -Path $php_dir -Source CurrentUser | ||||
| if ($version -eq 'master') { | ||||
|   Copy-Item $dir"\..\src\bin\php_pcov.dll" -Destination $ext_dir"\php_pcov.dll" | ||||
|   if($installed.ThreadSafe) { | ||||
|     Copy-Item $dir"\..\src\bin\php_ts_pcov.dll" -Destination $ext_dir"\php_pcov.dll" | ||||
|   } else { | ||||
|     Copy-Item $dir"\..\src\bin\php_pcov.dll" -Destination $ext_dir"\php_pcov.dll" | ||||
|   } | ||||
|   Set-PhpIniKey -Key 'opcache.jit_buffer_size' -Value '256M' -Path $php_dir | ||||
|   Set-PhpIniKey -Key 'opcache.jit' -Value '1235' -Path $php_dir | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur