mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Install PHP only if not found and support 7.4.0RC2
This commit is contained in:
parent
69f9b777e1
commit
a398f54da4
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
max-parallel: 6
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
|
||||
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
@ -13,7 +13,7 @@
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4 `7.4.0beta4` on `ubuntu`, and `7.4.0RC1` on `windows` and `macOS`
|
||||
- 7.4 `7.4.0beta4` on `ubuntu`, and `7.4.0RC2` on `windows` and `macOS`
|
||||
|
||||
**Note:** PHP 7.4 is currently in development, do not use in production.
|
||||
|
||||
|
@ -41,8 +41,8 @@ sudo mkdir -p /opt/phpbrew
|
||||
phpbrew init --root=/opt/phpbrew
|
||||
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
phpbrew install -j 10 7.4.0RC1 +default +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" -openssl -- --with-libxml
|
||||
phpbrew switch php-7.4.0RC1 >> /dev/null
|
||||
phpbrew install -j 10 7.4.0RC2 +default +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" -openssl -- --with-libxml
|
||||
phpbrew switch php-7.4.0RC2 >> /dev/null
|
||||
sudo mkdir -p /usr/local/bin
|
||||
sudo ln -sf /Users/runner/.phpbrew/php/php-7.4.0RC1/bin/php /usr/local/bin/php
|
||||
sudo ln -sf /Users/runner/.phpbrew/php/php-7.4.0RC2/bin/php /usr/local/bin/php
|
||||
brew install composer
|
@ -1,8 +1,11 @@
|
||||
echo $1
|
||||
brew unlink php
|
||||
brew tap exolnet/homebrew-deprecated
|
||||
brew install php@$1
|
||||
brew link --force --overwrite php@$1
|
||||
version=$(php-config --version | cut -c 1-3)
|
||||
if [ "$version" != "$1" ]; then
|
||||
brew tap exolnet/homebrew-deprecated;
|
||||
brew unlink php;
|
||||
brew install php@$1;
|
||||
brew link --force --overwrite php@$1;
|
||||
fi
|
||||
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
chmod +x composer.phar
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
|
32
src/linux.sh
32
src/linux.sh
@ -1,10 +1,26 @@
|
||||
sudo add-apt-repository ppa:ondrej/php -y
|
||||
sudo apt update -y
|
||||
sudo mkdir -p /run/php
|
||||
sudo apt install -y php$1 curl
|
||||
sudo apt autoremove -y
|
||||
sudo update-alternatives --set php /usr/bin/php$1
|
||||
sudo curl -s https://getcomposer.org/installer | php
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
ua()
|
||||
{
|
||||
for tool in php phar phar.phar php-cgi php-config phpize; do
|
||||
if [ -e "/usr/bin/$tool$version" ]; then
|
||||
sudo update-alternatives --set $tool /usr/bin/$tool$1;
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
version=$(php-config --version | cut -c 1-3)
|
||||
if [ "$version" != "$1" ]; then
|
||||
if [ ! -e "/usr/bin/php$1" ]; then
|
||||
sudo add-apt-repository ppa:ondrej/php -y
|
||||
sudo apt update -y
|
||||
sudo apt install -y php$1 curl;
|
||||
sudo apt autoremove -y;
|
||||
fi
|
||||
ua $1;
|
||||
fi
|
||||
|
||||
if [ ! -e "/usr/bin/composer" ]; then
|
||||
sudo curl -s https://getcomposer.org/installer | php;
|
||||
sudo mv composer.phar /usr/local/bin/composer;
|
||||
fi
|
||||
php -v
|
||||
composer -V
|
@ -3,37 +3,44 @@ param (
|
||||
)
|
||||
|
||||
if($version -eq '7.4') {
|
||||
$version = '7.4RC1'
|
||||
$version = '7.4RC'
|
||||
}
|
||||
|
||||
echo "Installing NuGet"
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
if($version -lt '7.0') {
|
||||
echo "Installing Visual C++"
|
||||
Install-Module -Name VcRedist -Force
|
||||
New-Item -Path C:\Temp\VcRedist -ItemType Directory
|
||||
Get-VcList | Save-VcRedist -Path C:\Temp\VcRedist
|
||||
$VcList = Get-VcList
|
||||
Install-VcRedist -Path C:\Temp\VcRedist -VcList $VcList -Silent
|
||||
}
|
||||
echo "Installing PhpManager"
|
||||
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
||||
echo "Installing PHP"
|
||||
Uninstall-Php C:\tools\php
|
||||
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production
|
||||
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$version\php.ini "date.timezone = 'UTC'"
|
||||
Set-PhpIniKey extension_dir C:\tools\php$version\ext
|
||||
if($version -lt '7.4') {
|
||||
Enable-PhpExtension openssl
|
||||
} else {
|
||||
Add-Content C:\tools\php$version\php.ini "extension=php_openssl.dll"
|
||||
|
||||
$installed = php -v | grep ^PHP | cut -c 5-7
|
||||
echo $installed
|
||||
echo $version
|
||||
if($installed -ne $version) {
|
||||
if($version -lt '7.0') {
|
||||
echo "Installing Visual C++"
|
||||
Install-Module -Name VcRedist -Force
|
||||
New-Item -Path C:\Temp\VcRedist -ItemType Directory
|
||||
Get-VcList | Save-VcRedist -Path C:\Temp\VcRedist
|
||||
$VcList = Get-VcList
|
||||
Install-VcRedist -Path C:\Temp\VcRedist -VcList $VcList -Silent
|
||||
}
|
||||
|
||||
echo "Installing PHP"
|
||||
Uninstall-Php C:\tools\php
|
||||
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production
|
||||
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$version\php.ini "date.timezone = 'UTC'"
|
||||
Set-PhpIniKey extension_dir C:\tools\php$version\ext
|
||||
if($version -lt '7.4') {
|
||||
Enable-PhpExtension openssl
|
||||
} else {
|
||||
Add-Content C:\tools\php$version\php.ini "extension=php_openssl.dll"
|
||||
}
|
||||
}
|
||||
|
||||
echo "Installing Composer"
|
||||
Install-Composer -Scope System -Path C:\tools\php
|
||||
php -v
|
||||
|
Loading…
Reference in New Issue
Block a user