diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5c1c77c3..0a24ea69 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -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 diff --git a/README.md b/README.md index f29b0119..e37cda68 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/7.4.sh b/src/7.4.sh index 3ccdda20..01c531b7 100644 --- a/src/7.4.sh +++ b/src/7.4.sh @@ -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 \ No newline at end of file diff --git a/src/darwin.sh b/src/darwin.sh index 98c96369..b4c3b0c9 100644 --- a/src/darwin.sh +++ b/src/darwin.sh @@ -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 diff --git a/src/linux.sh b/src/linux.sh index eaa636d5..bdc88e4e 100644 --- a/src/linux.sh +++ b/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 \ No newline at end of file diff --git a/src/windows.ps1 b/src/windows.ps1 index b093b70c..ef740862 100644 --- a/src/windows.ps1 +++ b/src/windows.ps1 @@ -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