mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-19 21:33:30 +07:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
db44db4b97 | |||
601f50f55e | |||
e71c06a64f | |||
c5825452ec | |||
339c69c9a5 |
@ -42,26 +42,28 @@ function asyncForEach(array, callback) {
|
|||||||
Enable extensions which are installed but not enabled
|
Enable extensions which are installed but not enabled
|
||||||
*/
|
*/
|
||||||
function enableExtension(extension) {
|
function enableExtension(extension) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
windows += `try {
|
||||||
windows += `try {
|
$${extension}_found = 0
|
||||||
$ext_dir = Get-PhpIniKey extension_dir
|
$ext_dir = Get-PhpIniKey extension_dir
|
||||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
||||||
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
|
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
|
||||||
if($enabled -eq 'no' -and $exist) {
|
if($enabled -eq 'no' -and $exist) {
|
||||||
Enable-PhpExtension ${extension} C:\\tools\\php$version
|
Enable-PhpExtension ${extension} C:\\tools\\php$version
|
||||||
|
$${extension}_found = 1
|
||||||
}
|
}
|
||||||
} catch [Exception] {
|
} catch [Exception] {
|
||||||
echo $_
|
echo $_
|
||||||
}\n`;
|
}\n`;
|
||||||
let shell_code = `ext_dir=$(php-config --extension-dir)
|
let shell_code = `ext_dir=$(php-config --extension-dir)
|
||||||
|
${extension}_found=0
|
||||||
enabled=$(php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}")
|
enabled=$(php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}")
|
||||||
if [ "$enabled" = "no" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
if [ "$enabled" = "no" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
||||||
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
|
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
|
||||||
echo "${extension} enabled"
|
echo "${extension} enabled"
|
||||||
|
${extension}_found=1
|
||||||
fi\n`;
|
fi\n`;
|
||||||
linux += shell_code;
|
linux += shell_code;
|
||||||
darwin += shell_code;
|
darwin += shell_code;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Install and enable extensions
|
Install and enable extensions
|
||||||
@ -86,7 +88,9 @@ function addExtension(extension_csv, version) {
|
|||||||
// else add script to attempt to install the extension
|
// else add script to attempt to install the extension
|
||||||
if (os_version == 'linux') {
|
if (os_version == 'linux') {
|
||||||
linux +=
|
linux +=
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
'if [ $' +
|
||||||
|
extension +
|
||||||
|
'_found -eq 0 ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
||||||
version +
|
version +
|
||||||
'-' +
|
'-' +
|
||||||
extension +
|
extension +
|
||||||
@ -94,7 +98,7 @@ function addExtension(extension_csv, version) {
|
|||||||
version +
|
version +
|
||||||
'-' +
|
'-' +
|
||||||
extension +
|
extension +
|
||||||
'"\n';
|
'"; fi\n';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// check if pecl extension exists
|
// check if pecl extension exists
|
||||||
@ -109,19 +113,24 @@ function addExtension(extension_csv, version) {
|
|||||||
extension_version = 'alpha';
|
extension_version = 'alpha';
|
||||||
}
|
}
|
||||||
windows +=
|
windows +=
|
||||||
'try { Install-PhpExtension ' +
|
'if($' +
|
||||||
|
extension +
|
||||||
|
'_found -eq 0) { ' +
|
||||||
|
'try { Install-PhpExtension ' +
|
||||||
extension +
|
extension +
|
||||||
' -MinimumStability ' +
|
' -MinimumStability ' +
|
||||||
extension_version +
|
extension_version +
|
||||||
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
|
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
|
||||||
extension +
|
extension +
|
||||||
' }\n';
|
' } }\n';
|
||||||
darwin +=
|
darwin +=
|
||||||
'pecl install ' +
|
'if [ $' +
|
||||||
|
extension +
|
||||||
|
'_found -eq 0 ]; then sudo pecl install ' +
|
||||||
extension +
|
extension +
|
||||||
' || echo "Couldn\'t find extension: ' +
|
' || echo "Couldn\'t find extension: ' +
|
||||||
extension +
|
extension +
|
||||||
'"\n';
|
'"; fi\n';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('Cannot find pecl extension: ' + extension);
|
console.log('Cannot find pecl extension: ' + extension);
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-php",
|
"name": "setup-php",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "Setup php action",
|
"description": "Setup php action",
|
||||||
"main": "lib/setup-php.js",
|
"main": "lib/setup-php.js",
|
||||||
|
@ -45,4 +45,6 @@ phpbrew install -j 10 7.4.0RC2 +default +bz2="$(brew --prefix bzip2)" +zlib="$(b
|
|||||||
phpbrew switch php-7.4.0RC2 >> /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.0RC2/bin/php /usr/local/bin/php
|
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")
|
||||||
|
sudo chmod 777 $ini_file
|
||||||
brew install composer
|
brew install composer
|
@ -9,8 +9,10 @@ else
|
|||||||
fi
|
fi
|
||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
sudo chmod 777 $ini_file
|
sudo chmod 777 $ini_file
|
||||||
|
mkdir -p $(pecl config-get ext_dir)
|
||||||
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
|
||||||
|
composer global require hirak/prestissimo
|
||||||
php -v
|
php -v
|
||||||
composer -V
|
composer -V
|
@ -27,23 +27,27 @@ async function asyncForEach(array: any, callback: any) {
|
|||||||
/*
|
/*
|
||||||
Enable extensions which are installed but not enabled
|
Enable extensions which are installed but not enabled
|
||||||
*/
|
*/
|
||||||
async function enableExtension(extension: string) {
|
function enableExtension(extension: string) {
|
||||||
windows += `try {
|
windows += `try {
|
||||||
|
$${extension}_found = 0
|
||||||
$ext_dir = Get-PhpIniKey extension_dir
|
$ext_dir = Get-PhpIniKey extension_dir
|
||||||
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
$exist = Test-Path -Path $ext_dir\\php_${extension}.dll
|
||||||
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
|
$enabled = php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}"
|
||||||
if($enabled -eq 'no' -and $exist) {
|
if($enabled -eq 'no' -and $exist) {
|
||||||
Enable-PhpExtension ${extension} C:\\tools\\php$version
|
Enable-PhpExtension ${extension} C:\\tools\\php$version
|
||||||
|
$${extension}_found = 1
|
||||||
}
|
}
|
||||||
} catch [Exception] {
|
} catch [Exception] {
|
||||||
echo $_
|
echo $_
|
||||||
}\n`;
|
}\n`;
|
||||||
|
|
||||||
let shell_code = `ext_dir=$(php-config --extension-dir)
|
let shell_code = `ext_dir=$(php-config --extension-dir)
|
||||||
|
${extension}_found=0
|
||||||
enabled=$(php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}")
|
enabled=$(php -r "if (in_array('${extension}', get_loaded_extensions())) {echo 'yes';} else {echo 'no';}")
|
||||||
if [ "$enabled" = "no" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
if [ "$enabled" = "no" ] && [ -e "$ext_dir/${extension}.so" ]; then
|
||||||
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
|
echo "extension=${extension}.so" >> 'php -i | grep "Loaded Configuration" | sed -e "s|.*=>\s*||"'
|
||||||
echo "${extension} enabled"
|
echo "${extension} enabled"
|
||||||
|
${extension}_found=1
|
||||||
fi\n`;
|
fi\n`;
|
||||||
linux += shell_code;
|
linux += shell_code;
|
||||||
darwin += shell_code;
|
darwin += shell_code;
|
||||||
@ -71,7 +75,9 @@ async function addExtension(extension_csv: string, version: string) {
|
|||||||
// else add script to attempt to install the extension
|
// else add script to attempt to install the extension
|
||||||
if (os_version == 'linux') {
|
if (os_version == 'linux') {
|
||||||
linux +=
|
linux +=
|
||||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
'if [ $' +
|
||||||
|
extension +
|
||||||
|
'_found -eq 0 ]; then sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
||||||
version +
|
version +
|
||||||
'-' +
|
'-' +
|
||||||
extension +
|
extension +
|
||||||
@ -79,7 +85,7 @@ async function addExtension(extension_csv: string, version: string) {
|
|||||||
version +
|
version +
|
||||||
'-' +
|
'-' +
|
||||||
extension +
|
extension +
|
||||||
'"\n';
|
'"; fi\n';
|
||||||
} else {
|
} else {
|
||||||
// check if pecl extension exists
|
// check if pecl extension exists
|
||||||
const http = new httpm.HttpClient('shivammathur/php-setup', [], {
|
const http = new httpm.HttpClient('shivammathur/php-setup', [], {
|
||||||
@ -95,19 +101,24 @@ async function addExtension(extension_csv: string, version: string) {
|
|||||||
extension_version = 'alpha';
|
extension_version = 'alpha';
|
||||||
}
|
}
|
||||||
windows +=
|
windows +=
|
||||||
|
'if($' +
|
||||||
|
extension +
|
||||||
|
'_found -eq 0) { ' +
|
||||||
'try { Install-PhpExtension ' +
|
'try { Install-PhpExtension ' +
|
||||||
extension +
|
extension +
|
||||||
' -MinimumStability ' +
|
' -MinimumStability ' +
|
||||||
extension_version +
|
extension_version +
|
||||||
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
|
' } catch [Exception] { echo $_; echo "Could not install extension: "' +
|
||||||
extension +
|
extension +
|
||||||
' }\n';
|
' } }\n';
|
||||||
darwin +=
|
darwin +=
|
||||||
'pecl install ' +
|
'if [ $' +
|
||||||
|
extension +
|
||||||
|
'_found -eq 0 ]; then sudo pecl install ' +
|
||||||
extension +
|
extension +
|
||||||
' || echo "Couldn\'t find extension: ' +
|
' || echo "Couldn\'t find extension: ' +
|
||||||
extension +
|
extension +
|
||||||
'"\n';
|
'"; fi\n';
|
||||||
} else {
|
} else {
|
||||||
console.log('Cannot find pecl extension: ' + extension);
|
console.log('Cannot find pecl extension: ' + extension);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,9 @@ if [ ! -e "/usr/bin/composer" ]; then
|
|||||||
sudo curl -s https://getcomposer.org/installer | php;
|
sudo curl -s https://getcomposer.org/installer | php;
|
||||||
sudo mv composer.phar /usr/local/bin/composer;
|
sudo mv composer.phar /usr/local/bin/composer;
|
||||||
fi
|
fi
|
||||||
|
composer global require hirak/prestissimo
|
||||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||||
sudo chmod 777 $ini_file
|
sudo chmod 777 $ini_file
|
||||||
|
sudo mkdir -p /run/php
|
||||||
php -v
|
php -v
|
||||||
composer -V
|
composer -V
|
Reference in New Issue
Block a user