mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Exit on failing to setup PHP
This commit is contained in:
parent
f1c04eb1eb
commit
ce02569aea
@ -145,6 +145,10 @@ setup_php() {
|
|||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
sudo mkdir -m 777 -p "$ext_dir" "$HOME/.composer"
|
||||||
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
|
||||||
|
if [ ${semver%.*} != "$version" ]; then
|
||||||
|
add_log "$cross" "PHP" "Could not setup PHP $version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
sudo cp "$dist"/../src/configs/*.json "$RUNNER_TOOL_CACHE/"
|
||||||
add_log "$tick" "PHP" "$status PHP $semver"
|
add_log "$tick" "PHP" "$status PHP $semver"
|
||||||
}
|
}
|
||||||
|
@ -267,6 +267,10 @@ setup_php() {
|
|||||||
status="Found"
|
status="Found"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if ! command -v php"$version" >/dev/null; then
|
||||||
|
add_log "$cross" "PHP" "Could not setup PHP $version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
semver=$(php_semver)
|
semver=$(php_semver)
|
||||||
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
||||||
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
||||||
|
@ -397,12 +397,14 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') {
|
if ($version -lt '7.0' -and (Get-InstalledModule).Name -notcontains 'VcRedist') {
|
||||||
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
Install-PSPackage VcRedist VcRedist-main\VcRedist\VcRedist "$github/aaronparker/VcRedist/archive/main.zip" >$null 2>&1
|
||||||
}
|
}
|
||||||
if ($version -match $nightly_version) {
|
try {
|
||||||
Invoke-WebRequest -Uri $bintray/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
if ($version -match $nightly_version) {
|
||||||
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
Invoke-WebRequest -Uri $bintray/Get-PhpNightly.ps1 -OutFile $php_dir\Get-PhpNightly.ps1 > $null 2>&1
|
||||||
} else {
|
& $php_dir\Get-PhpNightly.ps1 -Architecture $arch -ThreadSafe $ts -Path $php_dir -Version $version > $null 2>&1
|
||||||
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
} else {
|
||||||
}
|
Install-Php -Version $version -Architecture $arch -ThreadSafe $ts -InstallVC -Path $php_dir -TimeZone UTC -InitialPhpIni Production -Force > $null 2>&1
|
||||||
|
}
|
||||||
|
} catch { }
|
||||||
} else {
|
} else {
|
||||||
if($env:update -eq 'true') {
|
if($env:update -eq 'true') {
|
||||||
Update-Php $php_dir >$null 2>&1
|
Update-Php $php_dir >$null 2>&1
|
||||||
@ -413,6 +415,10 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version
|
|||||||
}
|
}
|
||||||
|
|
||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
|
if($installed.MajorMinorVersion -ne $version) {
|
||||||
|
Add-Log $cross "PHP" "Could not setup PHP $version"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
('date.timezone=UTC', 'memory_limit=-1') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
('date.timezone=UTC', 'memory_limit=-1') | ForEach-Object { $p=$_.split('='); Set-PhpIniKey -Key $p[0] -Value $p[1] -Path $php_dir }
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object { Invoke-WebRequest -Uri $bintray/$_ -OutFile $php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach-Object { Invoke-WebRequest -Uri $bintray/$_ -OutFile $php_dir\$_ >$null 2>&1 }
|
||||||
|
Loading…
Reference in New Issue
Block a user