mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +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
|
max-parallel: 6
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
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:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
- 7.2
|
||||||
- 7.3
|
- 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.
|
**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
|
phpbrew init --root=/opt/phpbrew
|
||||||
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
|
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
phpbrew install -j 10 7.4.0RC1 +default +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" -openssl -- --with-libxml
|
phpbrew install -j 10 7.4.0RC2 +default +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" -openssl -- --with-libxml
|
||||||
phpbrew switch php-7.4.0RC1 >> /dev/null
|
phpbrew switch php-7.4.0RC2 >> /dev/null
|
||||||
sudo mkdir -p /usr/local/bin
|
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
|
brew install composer
|
@ -1,8 +1,11 @@
|
|||||||
echo $1
|
version=$(php-config --version | cut -c 1-3)
|
||||||
brew unlink php
|
if [ "$version" != "$1" ]; then
|
||||||
brew tap exolnet/homebrew-deprecated
|
brew tap exolnet/homebrew-deprecated;
|
||||||
brew install php@$1
|
brew unlink php;
|
||||||
brew link --force --overwrite php@$1
|
brew install php@$1;
|
||||||
|
brew link --force --overwrite php@$1;
|
||||||
|
fi
|
||||||
|
|
||||||
curl -sS https://getcomposer.org/installer | php
|
curl -sS https://getcomposer.org/installer | php
|
||||||
chmod +x composer.phar
|
chmod +x composer.phar
|
||||||
mv composer.phar /usr/local/bin/composer
|
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
|
ua()
|
||||||
sudo apt update -y
|
{
|
||||||
sudo mkdir -p /run/php
|
for tool in php phar phar.phar php-cgi php-config phpize; do
|
||||||
sudo apt install -y php$1 curl
|
if [ -e "/usr/bin/$tool$version" ]; then
|
||||||
sudo apt autoremove -y
|
sudo update-alternatives --set $tool /usr/bin/$tool$1;
|
||||||
sudo update-alternatives --set php /usr/bin/php$1
|
fi
|
||||||
sudo curl -s https://getcomposer.org/installer | php
|
done
|
||||||
sudo mv composer.phar /usr/local/bin/composer
|
}
|
||||||
|
|
||||||
|
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
|
php -v
|
||||||
composer -V
|
composer -V
|
@ -3,37 +3,44 @@ param (
|
|||||||
)
|
)
|
||||||
|
|
||||||
if($version -eq '7.4') {
|
if($version -eq '7.4') {
|
||||||
$version = '7.4RC1'
|
$version = '7.4RC'
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Installing NuGet"
|
echo "Installing NuGet"
|
||||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||||
if($version -lt '7.0') {
|
echo "Installing PhpManager"
|
||||||
|
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
||||||
|
|
||||||
|
$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++"
|
echo "Installing Visual C++"
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
New-Item -Path C:\Temp\VcRedist -ItemType Directory
|
New-Item -Path C:\Temp\VcRedist -ItemType Directory
|
||||||
Get-VcList | Save-VcRedist -Path C:\Temp\VcRedist
|
Get-VcList | Save-VcRedist -Path C:\Temp\VcRedist
|
||||||
$VcList = Get-VcList
|
$VcList = Get-VcList
|
||||||
Install-VcRedist -Path C:\Temp\VcRedist -VcList $VcList -Silent
|
Install-VcRedist -Path C:\Temp\VcRedist -VcList $VcList -Silent
|
||||||
}
|
}
|
||||||
echo "Installing PhpManager"
|
|
||||||
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
echo "Installing PHP"
|
||||||
echo "Installing PHP"
|
Uninstall-Php C:\tools\php
|
||||||
Uninstall-Php C:\tools\php
|
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production
|
||||||
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production
|
echo "Switch PHP"
|
||||||
echo "Switch PHP"
|
(Get-PhpSwitcher).targets
|
||||||
(Get-PhpSwitcher).targets
|
Initialize-PhpSwitcher -Alias C:\tools\php -Scope CurrentUser -Force
|
||||||
Initialize-PhpSwitcher -Alias C:\tools\php -Scope CurrentUser -Force
|
Add-PhpToSwitcher -Name $version -Path C:\tools\php$version -Force
|
||||||
Add-PhpToSwitcher -Name $version -Path C:\tools\php$version -Force
|
Switch-Php $version -Force
|
||||||
Switch-Php $version -Force
|
echo "Housekeeping in PHP.ini, enabling openssl"
|
||||||
echo "Housekeeping in PHP.ini, enabling openssl"
|
Add-Content C:\tools\php$version\php.ini "date.timezone = 'UTC'"
|
||||||
Add-Content C:\tools\php$version\php.ini "date.timezone = 'UTC'"
|
Set-PhpIniKey extension_dir C:\tools\php$version\ext
|
||||||
Set-PhpIniKey extension_dir C:\tools\php$version\ext
|
if($version -lt '7.4') {
|
||||||
if($version -lt '7.4') {
|
|
||||||
Enable-PhpExtension openssl
|
Enable-PhpExtension openssl
|
||||||
} else {
|
} else {
|
||||||
Add-Content C:\tools\php$version\php.ini "extension=php_openssl.dll"
|
Add-Content C:\tools\php$version\php.ini "extension=php_openssl.dll"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Installing Composer"
|
echo "Installing Composer"
|
||||||
Install-Composer -Scope System -Path C:\tools\php
|
Install-Composer -Scope System -Path C:\tools\php
|
||||||
php -v
|
php -v
|
||||||
|
Loading…
Reference in New Issue
Block a user