@@ -156,7 +156,7 @@ function InstallPeclExtension {
156
156
# https://windows.php.net/downloads/pecl/releases/psr/1.0.1/php_psr-1.0.1-7.4-ts-vc15-x86.zip
157
157
$PackageVersion = $Version
158
158
$CompatiblePhpVersion = $PhpVersion
159
- if ([System.Convert ]::ToDecimal($PhpVersion ) -ge 8.0 ) {
159
+ if (( [System.Convert ]::ToDecimal($PhpVersion ) -ge 8.0 ) -and ( $Name -Match " psr " ) ) {
160
160
$PackageVersion = " 1.0.1"
161
161
$CompatiblePhpVersion = " 7.4"
162
162
$VC = " 15"
@@ -171,8 +171,14 @@ function InstallPeclExtension {
171
171
$TS = " ts"
172
172
}
173
173
174
- $RemoteUrl = " ${BaseUri} /${LocalPart} -${TS} -vc${VC} -${Platform} .zip"
175
- $DestinationPath = " C:\Downloads\${LocalPart} -${TS} -vc${VC} -${Platform} .zip"
174
+ # A workaround for php 8.0
175
+ $CompilerVersion = " vc${VC} "
176
+ if ([System.Convert ]::ToDecimal($PhpVersion ) -ge 8.0 ) {
177
+ $CompilerVersion = " vs${VC} "
178
+ }
179
+
180
+ $RemoteUrl = " ${BaseUri} /${LocalPart} -${TS} -${CompilerVersion} -${Platform} .zip"
181
+ $DestinationPath = " C:\Downloads\${LocalPart} -${TS} -${CompilerVersion} -${Platform} .zip"
176
182
177
183
if (-not (Test-Path " ${InstallPath} \php_${Name} .dll" )) {
178
184
if (-not (Test-Path $DestinationPath )) {
@@ -240,7 +246,11 @@ function InstallComposer {
240
246
$ComposerPhar = " ${InstallPath} \composer.phar"
241
247
242
248
if (-not (Test-Path - Path $ComposerPhar )) {
243
- DownloadFile " https://getcomposer.org/composer.phar" " ${ComposerPhar} "
249
+ EnablePhpExtension - Name openssl
250
+ Invoke-Expression " ${PhpInstallPath} \php.exe -r `" copy('https://getcomposer.org/installer', 'composer-setup.php');`" "
251
+ Invoke-Expression " ${PhpInstallPath} \php.exe composer-setup.php"
252
+ Invoke-Expression " ${PhpInstallPath} \php.exe -r `" unlink('composer-setup.php');`" "
253
+ # DownloadFile "https://getcomposer.org/composer.phar" "${ComposerPhar}"
244
254
245
255
Write-Output ' @echo off' | Out-File - Encoding " ASCII" $ComposerBatch
246
256
Write-Output " ${PhpInstallPath} \php.exe `" ${ComposerPhar} `" %*" | Out-File - Encoding " ASCII" - Append $ComposerBatch
@@ -310,6 +320,46 @@ function EnablePhpExtension {
310
320
}
311
321
}
312
322
323
+ function EnableZendExtension {
324
+ param (
325
+ [Parameter (Mandatory = $true )] [System.String ] $Name ,
326
+ [Parameter (Mandatory = $false )] [System.String ] $PhpInstallPath = ' C:\php' ,
327
+ [Parameter (Mandatory = $false )] [System.String ] $ExtPath = ' C:\php\ext' ,
328
+ [Parameter (Mandatory = $false )] [System.String ] $PrintableName = ' '
329
+ )
330
+
331
+ $FullyQualifiedExtensionPath = " ${ExtPath} \php_${Name} .dll"
332
+
333
+ $IniFile = " ${PhpInstallPath} \php.ini"
334
+ $PhpExe = " ${PhpInstallPath} \php.exe"
335
+
336
+ if (-not (Test-Path $IniFile )) {
337
+ throw " Unable to locate ${IniFile} "
338
+ }
339
+
340
+ if (-not (Test-Path " ${ExtPath} " )) {
341
+ throw " Unable to locate ${ExtPath} direcory"
342
+ }
343
+
344
+ Write-Debug " Add `" zend_extension = ${FullyQualifiedExtensionPath} `" to the ${IniFile} "
345
+ Write-Output " zend_extension = ${FullyQualifiedExtensionPath} " | Out-File - Encoding " ASCII" - Append $IniFile
346
+
347
+ if (Test-Path - Path " ${PhpExe} " ) {
348
+ if ($PrintableName ) {
349
+ Write-Debug " Minimal load test using command: ${PhpExe} --ri `" ${PrintableName} `" "
350
+ $Result = (& " ${PhpExe} " -- ri " ${PrintableName} " )
351
+ } else {
352
+ Write-Debug " Minimal load test using command: ${PhpExe} --ri ${Name} "
353
+ $Result = (& " ${PhpExe} " -- ri " ${Name} " )
354
+ }
355
+
356
+ $ExitCode = $LASTEXITCODE
357
+ if ($ExitCode -ne 0 ) {
358
+ throw " An error occurred while enabling ${Name} at ${IniFile} . ${Result} "
359
+ }
360
+ }
361
+ }
362
+
313
363
function TuneUpPhp {
314
364
param (
315
365
[Parameter (Mandatory = $false )] [System.String ] $MemoryLimit = ' 256M' ,
0 commit comments