mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-08-19 03:54:41 +07:00
Optimize installation scripts
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
brew fetch autoconf& brew fetch automake& brew fetch pcre& brew fetch libtool& brew fetch libpng& brew fetch webp& brew fetch jpeg& brew fetch freetype& brew fetch libxml2& brew fetch pkg-config& brew fetch krb5& brew fetch icu4c& brew fetch re2c& brew fetch bison& brew fetch libzip& brew fetch mcrypt& brew fetch zlib& brew fetch bzip2& brew fetch enchant
|
||||
brew install autoconf automake pcre libtool libpng webp jpeg freetype libxml2 pkg-config krb5 icu4c re2c bison libzip mcrypt zlib bzip2 enchant >> /dev/null
|
||||
brew install autoconf automake pcre libtool libpng webp jpeg freetype libxml2 pkg-config krb5 icu4c re2c bison libzip mcrypt zlib bzip2 enchant > /dev/null 2>&1
|
||||
brew link --force gettext
|
||||
brew link --force bison
|
||||
brew link --force openssl
|
||||
@ -14,7 +14,7 @@ echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile
|
||||
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile
|
||||
echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.bash_profile
|
||||
echo 'export PATH="/Users/runner/.phpbrew/php/php-7.4.0RC1/bin:$PATH"' >> ~/.bash_profile
|
||||
source ~/.bash_profile >> /dev/null
|
||||
source ~/.bash_profile > /dev/null 2>&1
|
||||
export LIBXML_LIBS="-L/usr/local/opt/libxml2/lib"
|
||||
export LIBXML_CFLAGS="-I/usr/local/opt/libxml2/include"
|
||||
export ENCHANT_LIBS="-L/usr/local/opt/enchant/lib"
|
||||
@ -41,7 +41,7 @@ phpbrew init --root=/opt/phpbrew
|
||||
echo "[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc" >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
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
|
||||
phpbrew switch php-7.4.0RC2 > /dev/null 2>&1
|
||||
sudo mkdir -p /usr/local/bin
|
||||
sudo ln -sf /Users/runner/.phpbrew/php/php-7.4.0RC2/bin/php /usr/local/bin/php
|
||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
|
@ -1,12 +1,12 @@
|
||||
version=$(php-config --version | cut -c 1-3)
|
||||
if [ "$version" != "$1" ]; then
|
||||
export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
|
||||
brew tap exolnet/homebrew-deprecated;
|
||||
brew tap exolnet/homebrew-deprecated > /dev/null 2>&1;
|
||||
brew unlink php;
|
||||
brew install php@"$1";
|
||||
brew link --force --overwrite php@"$1";
|
||||
else
|
||||
sudo cp /etc/php.ini.default /etc/php.ini
|
||||
sudo cp /etc/php.ini.default /etc/php.ini
|
||||
fi
|
||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||
|
@ -34,7 +34,7 @@ export async function enableExtensionWindows(extension: string) {
|
||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
||||
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
|
||||
if($enabled -eq 'no' -and $exist) {
|
||||
Enable-PhpExtension ${extension} C:\\tools\\php$version
|
||||
Enable-PhpExtension ${extension} C:\\tools\\php
|
||||
$${extension}_found = 1
|
||||
}
|
||||
} catch [Exception] {
|
||||
@ -181,7 +181,7 @@ export async function addINIValuesWindows(
|
||||
await utils.asyncForEach(ini_values, async function(ini_value: string) {
|
||||
// add script to set ini value
|
||||
script +=
|
||||
'Add-Content C:\\tools\\php$version\\php.ini "' + ini_value + '"\n';
|
||||
'Add-Content C:\\tools\\php\\php.ini "' + ini_value + '"\n';
|
||||
});
|
||||
return script;
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
version=$(php-config --version | cut -c 1-3)
|
||||
if [ "$version" != "$1" ]; then
|
||||
if [ ! -e "/usr/bin/php$1" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install -y php"$1" curl php"$1"-curl;
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt autoremove -y;
|
||||
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php -y > /dev/null 2>&1
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt update -y > /dev/null 2>&1
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install -y php"$1" curl php"$1"-curl;
|
||||
fi
|
||||
for tool in php phar phar.phar php-cgi php-config phpize; do
|
||||
if [ -e "/usr/bin/$tool$1" ]; then
|
||||
@ -17,7 +16,7 @@ if [ ! -e "/usr/bin/composer" ]; then
|
||||
sudo curl -s https://getcomposer.org/installer | php;
|
||||
sudo mv composer.phar /usr/local/bin/composer;
|
||||
fi
|
||||
composer global require hirak/prestissimo
|
||||
composer global require hirak/prestissimo > /dev/null 2>&1
|
||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
ext_dir=$(/usr/bin/php -i | grep "extension_dir => /usr" | sed -e "s|.*=> s*||")
|
||||
sudo chmod 777 "$ini_file"
|
||||
|
@ -5,40 +5,33 @@ param (
|
||||
if($version -eq '7.4') {
|
||||
$version = '7.4RC'
|
||||
}
|
||||
echo "Installing NuGet"
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
|
||||
echo "Installing PhpManager"
|
||||
Install-Module -Name PhpManager -Force -Scope CurrentUser
|
||||
|
||||
$installed = php -v | grep ^PHP | cut -c 5-7
|
||||
echo $installed
|
||||
echo $version
|
||||
$installed = $($(php -v)[0] -join '')[4..6] -join ''
|
||||
if($installed -ne $version) {
|
||||
if($version -lt '7.0') {
|
||||
echo "Installing Visual C++"
|
||||
echo "Installing VcRedist"
|
||||
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
|
||||
Install-Php -Version $version -Architecture x86 -ThreadSafe $true -InstallVC -Path C:\tools\php$version -TimeZone UTC -InitialPhpIni Production -Force
|
||||
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 "Housekeeping in PHP.ini, enabling openssl"
|
||||
Add-Content C:\tools\php\php.ini "date.timezone = 'UTC'"
|
||||
Set-PhpIniKey extension_dir C:\tools\php\ext
|
||||
if($version -lt '7.4') {
|
||||
Enable-PhpExtension openssl
|
||||
} else {
|
||||
Add-Content C:\tools\php\php.ini "extension=php_openssl.dll"
|
||||
}
|
||||
|
||||
echo "Installing Composer"
|
||||
|
Reference in New Issue
Block a user