2019-12-20 19:59:05 +07:00
|
|
|
# Function to log start of a operation
|
2019-10-17 03:11:13 +07:00
|
|
|
step_log() {
|
|
|
|
message=$1
|
|
|
|
printf "\n\033[90;1m==> \033[0m\033[37;1m%s\033[0m\n" "$message"
|
|
|
|
}
|
|
|
|
|
2019-12-20 19:59:05 +07:00
|
|
|
# Function to log result of a operation
|
2019-10-17 03:11:13 +07:00
|
|
|
add_log() {
|
|
|
|
mark=$1
|
|
|
|
subject=$2
|
|
|
|
message=$3
|
|
|
|
if [ "$mark" = "$tick" ]; then
|
|
|
|
printf "\033[32;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
|
|
else
|
|
|
|
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s\033[0m\n" "$mark" "$subject" "$message"
|
|
|
|
fi
|
|
|
|
}
|
2019-12-19 12:59:27 +07:00
|
|
|
|
2019-12-20 19:59:05 +07:00
|
|
|
# Function to update php ppa
|
|
|
|
update_ppa() {
|
|
|
|
if [ "$ppa_updated" = "false" ]; then
|
2020-02-09 05:38:48 +07:00
|
|
|
if [[ "$version" =~ $old_versions ]]; then
|
|
|
|
ppa="dotdeb-ubuntu-php*.list"
|
|
|
|
else
|
|
|
|
ppa="ondrej-ubuntu-php*.list"
|
|
|
|
fi
|
2020-02-14 00:09:00 +07:00
|
|
|
find /etc/apt/sources.list.d -type f -name "$ppa" -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
|
2020-02-21 09:28:19 +07:00
|
|
|
ppa_updated="true"
|
2019-12-20 19:59:05 +07:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-02-14 00:09:00 +07:00
|
|
|
# Function to configure PECL
|
2020-01-27 21:36:04 +07:00
|
|
|
configure_pecl() {
|
|
|
|
if [ "$pecl_config" = "false" ] && [ -e /usr/bin/pecl ]; then
|
|
|
|
for tool in pear pecl; do
|
2020-01-30 13:33:30 +07:00
|
|
|
sudo "$tool" config-set php_ini "$ini_file" >/dev/null 2>&1
|
|
|
|
sudo "$tool" config-set auto_discover 1 >/dev/null 2>&1
|
|
|
|
sudo "$tool" channel-update "$tool".php.net >/dev/null 2>&1
|
2020-01-27 21:36:04 +07:00
|
|
|
done
|
|
|
|
pecl_config="true"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-30 13:33:30 +07:00
|
|
|
# Fuction to get the PECL version
|
|
|
|
get_pecl_version() {
|
|
|
|
extension=$1
|
|
|
|
stability=$2
|
|
|
|
pecl_rest='https://pecl.php.net/rest/r/'
|
|
|
|
response=$(curl -q -sSL "$pecl_rest$extension"/allreleases.xml)
|
|
|
|
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*$stability\d*)")
|
|
|
|
if [ ! "$pecl_version" ]; then
|
|
|
|
pecl_version=$(echo "$response" | grep -m 1 -Po "(\d*\.\d*\.\d*)")
|
|
|
|
fi
|
|
|
|
echo "$pecl_version"
|
|
|
|
}
|
|
|
|
|
2020-02-23 20:30:40 +07:00
|
|
|
# Function to test if extension is loaded
|
|
|
|
check_extension() {
|
2020-03-16 08:23:58 +07:00
|
|
|
extension=$1
|
|
|
|
if [ "$extension" != "mysql" ]; then
|
|
|
|
php -m | grep -i -q -w "$extension"
|
|
|
|
else
|
|
|
|
php -m | grep -i -q "$extension"
|
|
|
|
fi
|
2019-12-20 19:59:05 +07:00
|
|
|
}
|
|
|
|
|
2020-01-30 13:33:30 +07:00
|
|
|
# Function to delete extensions
|
|
|
|
delete_extension() {
|
2020-01-26 02:34:09 +07:00
|
|
|
extension=$1
|
2020-01-30 13:33:30 +07:00
|
|
|
sudo sed -i "/$extension/d" "$ini_file"
|
2020-02-09 05:38:48 +07:00
|
|
|
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
2020-01-30 13:33:30 +07:00
|
|
|
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
2020-01-26 02:34:09 +07:00
|
|
|
}
|
|
|
|
|
2020-01-30 13:33:30 +07:00
|
|
|
# Function to disable and delete extensions
|
2019-12-26 20:01:18 +07:00
|
|
|
remove_extension() {
|
|
|
|
extension=$1
|
2020-02-19 08:52:01 +07:00
|
|
|
if [[ ! "$version" =~ $old_versions ]] && [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
2019-12-27 08:26:49 +07:00
|
|
|
sudo phpdismod -v "$version" "$extension"
|
2019-12-26 20:01:18 +07:00
|
|
|
fi
|
2020-01-30 13:33:30 +07:00
|
|
|
delete_extension "$extension"
|
|
|
|
}
|
|
|
|
|
2020-03-05 07:28:24 +07:00
|
|
|
# Function to enable existing extension
|
|
|
|
enable_extension() {
|
|
|
|
if ! check_extension "$1" && [ -e "$ext_dir/$1.so" ]; then
|
|
|
|
echo "$2=$1.so" >>"$ini_file"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Funcion to add PDO extension
|
|
|
|
add_pdo_extension() {
|
|
|
|
pdo_ext="pdo_$1"
|
|
|
|
if check_extension "$pdo_ext"; then
|
|
|
|
add_log "$tick" "$pdo_ext" "Enabled"
|
|
|
|
else
|
|
|
|
read -r ext ext_name <<< "$1 $1"
|
|
|
|
sudo rm -rf "$scan_dir"/*pdo.ini >/dev/null 2>&1 && enable_extension "pdo" "extension" >/dev/null 2>&1
|
|
|
|
if [ "$ext" = "mysql" ]; then
|
|
|
|
enable_extension "mysqlnd" "extension"
|
|
|
|
ext_name="mysqli"
|
|
|
|
fi
|
|
|
|
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
|
|
|
|
enable_extension "$pdo_ext" "extension"
|
|
|
|
(check_extension "$pdo_ext" && add_log "$tick" "$pdo_ext" "Enabled") ||
|
|
|
|
add_log "$cross" "$pdo_ext" "Could not install $pdo_ext on PHP $semver"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-02-23 20:30:40 +07:00
|
|
|
# Function to setup extensions
|
|
|
|
add_extension() {
|
|
|
|
extension=$1
|
|
|
|
install_command=$2
|
|
|
|
prefix=$3
|
|
|
|
if [[ "$version" =~ $old_versions ]]; then
|
|
|
|
install_command="update_ppa && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
|
|
|
|
fi
|
2020-03-05 07:28:24 +07:00
|
|
|
enable_extension "$extension" "$prefix"
|
|
|
|
if check_extension "$extension"; then
|
2020-02-23 20:30:40 +07:00
|
|
|
add_log "$tick" "$extension" "Enabled"
|
2020-03-05 07:28:24 +07:00
|
|
|
else
|
2020-02-23 20:30:40 +07:00
|
|
|
eval "$install_command" >/dev/null 2>&1 ||
|
|
|
|
(update_ppa && eval "$install_command" >/dev/null 2>&1) ||
|
|
|
|
sudo pecl install -f "$extension" >/dev/null 2>&1
|
|
|
|
(check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
|
|
|
|
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
|
|
|
fi
|
|
|
|
sudo chmod 777 "$ini_file"
|
|
|
|
}
|
|
|
|
|
2020-01-30 13:33:30 +07:00
|
|
|
# Function to install a PECL version
|
|
|
|
add_pecl_extension() {
|
|
|
|
extension=$1
|
|
|
|
pecl_version=$2
|
2020-02-23 20:30:40 +07:00
|
|
|
prefix=$3
|
|
|
|
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
|
|
|
echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"
|
|
|
|
fi
|
|
|
|
ext_version=$(php -r "echo phpversion('$extension');")
|
|
|
|
if [ "$ext_version" = "$pecl_version" ]; then
|
|
|
|
add_log "$tick" "$extension" "Enabled"
|
|
|
|
else
|
|
|
|
delete_extension "$extension"
|
|
|
|
(
|
|
|
|
sudo pecl install -f "$extension-$pecl_version" >/dev/null 2>&1 &&
|
|
|
|
check_extension "$extension" &&
|
|
|
|
add_log "$tick" "$extension" "Installed and enabled"
|
|
|
|
) || add_log "$cross" "$extension" "Could not install $extension-$pecl_version on PHP $semver"
|
|
|
|
fi
|
2020-01-30 13:33:30 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function to pre-release extensions using PECL
|
|
|
|
add_unstable_extension() {
|
|
|
|
extension=$1
|
|
|
|
stability=$2
|
|
|
|
prefix=$3
|
|
|
|
pecl_version=$(get_pecl_version "$extension" "$stability")
|
2020-02-23 20:30:40 +07:00
|
|
|
add_pecl_extension "$extension" "$pecl_version" "$prefix"
|
2019-12-27 08:26:49 +07:00
|
|
|
}
|
|
|
|
|
2020-01-14 08:27:04 +07:00
|
|
|
# Function to update extension
|
|
|
|
update_extension() {
|
|
|
|
extension=$1
|
|
|
|
latest_version=$2
|
|
|
|
current_version=$(php -r "echo phpversion('$extension');")
|
|
|
|
final_version=$(printf "%s\n%s" "$current_version" "$latest_version" | sort | tail -n 1)
|
|
|
|
if [ "$final_version" != "$current_version" ]; then
|
|
|
|
version_exists=$(apt-cache policy -- *"$extension" | grep "$final_version")
|
|
|
|
if [ -z "$version_exists" ]; then
|
2020-02-19 08:52:01 +07:00
|
|
|
update_ppa
|
2020-01-14 08:27:04 +07:00
|
|
|
fi
|
|
|
|
$apt_install php"$version"-"$extension"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-12-27 08:26:49 +07:00
|
|
|
# Function to setup a remote tool
|
|
|
|
add_tool() {
|
|
|
|
url=$1
|
|
|
|
tool=$2
|
2020-02-22 23:11:40 +07:00
|
|
|
tool_path="$tool_path_dir/$tool"
|
2020-02-03 01:21:44 +07:00
|
|
|
if [ ! -e "$tool_path" ]; then
|
|
|
|
rm -rf "$tool_path"
|
2019-12-27 08:26:49 +07:00
|
|
|
fi
|
2020-02-03 01:21:44 +07:00
|
|
|
status_code=$(sudo curl -s -w "%{http_code}" -o "$tool_path" -L "$url")
|
2020-01-07 09:36:14 +07:00
|
|
|
if [ "$status_code" = "200" ]; then
|
2020-02-03 01:21:44 +07:00
|
|
|
sudo chmod a+x "$tool_path"
|
2020-01-30 13:33:30 +07:00
|
|
|
if [ "$tool" = "composer" ]; then
|
|
|
|
composer -q global config process-timeout 0
|
2020-02-03 01:21:44 +07:00
|
|
|
elif [ "$tool" = "cs2pr" ]; then
|
|
|
|
sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path"
|
2020-01-30 13:33:30 +07:00
|
|
|
elif [ "$tool" = "phive" ]; then
|
2020-02-09 05:38:48 +07:00
|
|
|
add_extension curl "$apt_install php$version-curl" extension >/dev/null 2>&1
|
|
|
|
add_extension mbstring "$apt_install php$version-mbstring" extension >/dev/null 2>&1
|
|
|
|
add_extension xml "$apt_install php$version-xml" extension >/dev/null 2>&1
|
2020-02-22 11:36:14 +07:00
|
|
|
elif [ "$tool" = "wp-cli" ]; then
|
2020-02-22 23:11:40 +07:00
|
|
|
sudo cp -p "$tool_path" "$tool_path_dir"/wp
|
2020-01-30 13:33:30 +07:00
|
|
|
fi
|
2020-01-07 09:36:14 +07:00
|
|
|
add_log "$tick" "$tool" "Added"
|
|
|
|
else
|
|
|
|
add_log "$cross" "$tool" "Could not setup $tool"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-30 13:33:30 +07:00
|
|
|
# Function to setup a tool using composer
|
2020-02-28 14:49:12 +07:00
|
|
|
add_composertool() {
|
2020-01-07 09:36:14 +07:00
|
|
|
tool=$1
|
|
|
|
release=$2
|
|
|
|
prefix=$3
|
|
|
|
(
|
2020-01-30 13:33:30 +07:00
|
|
|
composer global require "$prefix$release" >/dev/null 2>&1 &&
|
|
|
|
sudo ln -sf "$(composer -q global config home)"/vendor/bin/"$tool" /usr/local/bin/"$tool" &&
|
|
|
|
add_log "$tick" "$tool" "Added"
|
2020-01-07 09:36:14 +07:00
|
|
|
) || add_log "$cross" "$tool" "Could not setup $tool"
|
2019-12-26 20:01:18 +07:00
|
|
|
}
|
|
|
|
|
2020-01-17 14:28:28 +07:00
|
|
|
# Function to setup phpize and php-config
|
|
|
|
add_devtools() {
|
|
|
|
if ! [ -e "/usr/bin/phpize$version" ] || ! [ -e "/usr/bin/php-config$version" ]; then
|
|
|
|
$apt_install php"$version"-dev php"$version"-xml >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
sudo update-alternatives --set php-config /usr/bin/php-config"$version" >/dev/null 2>&1
|
|
|
|
sudo update-alternatives --set phpize /usr/bin/phpize"$version" >/dev/null 2>&1
|
2020-01-27 21:36:04 +07:00
|
|
|
configure_pecl
|
2020-01-17 14:28:28 +07:00
|
|
|
}
|
|
|
|
|
2020-02-28 14:49:12 +07:00
|
|
|
add_blackfire() {
|
|
|
|
sudo mkdir -p /var/run/blackfire
|
|
|
|
sudo curl -o /tmp/blackfire-gpg.key -sSL https://packages.blackfire.io/gpg.key >/dev/null 2>&1
|
|
|
|
sudo apt-key add /tmp/blackfire-gpg.key >/dev/null 2>&1
|
|
|
|
echo "deb http://packages.blackfire.io/debian any main" | sudo tee /etc/apt/sources.list.d/blackfire.list >/dev/null 2>&1
|
|
|
|
find /etc/apt/sources.list.d -type f -name blackfire.list -exec sudo "$debconf_fix" apt-fast update -o Dir::Etc::sourcelist="{}" ';' >/dev/null 2>&1
|
|
|
|
$apt_install blackfire-agent >/dev/null 2>&1
|
|
|
|
sudo blackfire-agent --register --server-id="$BLACKFIRE_SERVER_ID" --server-token="$BLACKFIRE_SERVER_TOKEN" >/dev/null 2>&1
|
|
|
|
sudo /etc/init.d/blackfire-agent restart >/dev/null 2>&1
|
|
|
|
sudo blackfire --config --client-id="$BLACKFIRE_CLIENT_ID" --client-token="$BLACKFIRE_CLIENT_TOKEN" >/dev/null 2>&1
|
2020-03-02 21:09:18 +07:00
|
|
|
add_log "$tick" "blackfire" "Added"
|
|
|
|
add_log "$tick" "blackfire-agent" "Added"
|
2020-02-28 14:49:12 +07:00
|
|
|
}
|
|
|
|
|
2019-12-20 19:59:05 +07:00
|
|
|
# Function to setup the nightly build from master branch
|
|
|
|
setup_master() {
|
|
|
|
tar_file=php_"$version"%2Bubuntu"$(lsb_release -r -s)".tar.xz
|
|
|
|
install_dir=~/php/"$version"
|
|
|
|
sudo mkdir -m 777 -p ~/php
|
2020-02-23 03:16:35 +07:00
|
|
|
update_ppa && $apt_install libicu-dev >/dev/null 2>&1
|
2020-02-09 05:38:48 +07:00
|
|
|
curl -SLO https://dl.bintray.com/shivammathur/php/"$tar_file" >/dev/null 2>&1
|
2019-12-20 19:59:05 +07:00
|
|
|
sudo tar xf "$tar_file" -C ~/php >/dev/null 2>&1
|
|
|
|
rm -rf "$tar_file"
|
|
|
|
sudo ln -sf -S "$version" "$install_dir"/bin/* /usr/bin/
|
|
|
|
sudo ln -sf "$install_dir"/etc/php.ini /etc/php.ini
|
2019-12-19 12:59:27 +07:00
|
|
|
}
|
|
|
|
|
2020-02-09 05:38:48 +07:00
|
|
|
# Function to setup PHP 5.3, PHP 5.4 and PHP 5.5
|
|
|
|
setup_old_versions() {
|
|
|
|
(
|
|
|
|
cd /tmp || exit
|
|
|
|
curl -SLO https://dl.bintray.com/shivammathur/php/php-"$version".tar.xz >/dev/null 2>&1
|
|
|
|
sudo tar xf php-"$version".tar.xz >/dev/null 2>&1
|
|
|
|
cd php-"$version" || exit
|
|
|
|
sudo chmod a+x ./*.sh
|
|
|
|
./install.sh >/dev/null 2>&1
|
|
|
|
./post-install.sh >/dev/null 2>&1
|
|
|
|
)
|
|
|
|
sudo rm -rf /tmp/php-"$version"
|
|
|
|
configure_pecl
|
|
|
|
release_version=$(php -v | head -n 1 | cut -d' ' -f 2)
|
|
|
|
}
|
|
|
|
|
2019-12-20 19:59:05 +07:00
|
|
|
# Function to setup PECL
|
2019-12-27 08:26:49 +07:00
|
|
|
add_pecl() {
|
2020-01-17 14:28:28 +07:00
|
|
|
add_devtools
|
2020-01-30 13:33:30 +07:00
|
|
|
if [ ! -e /usr/bin/pecl ]; then
|
|
|
|
$apt_install php-pear >/dev/null 2>&1
|
|
|
|
fi
|
2020-01-27 21:36:04 +07:00
|
|
|
configure_pecl
|
2019-12-27 08:26:49 +07:00
|
|
|
add_log "$tick" "PECL" "Added"
|
2019-12-20 19:59:05 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Function to switch versions of PHP binaries
|
|
|
|
switch_version() {
|
|
|
|
for tool in pear pecl php phar phar.phar php-cgi php-config phpize phpdbg; do
|
|
|
|
if [ -e "/usr/bin/$tool$version" ]; then
|
|
|
|
sudo update-alternatives --set $tool /usr/bin/"$tool$version" >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2020-02-21 09:28:19 +07:00
|
|
|
# Function to get PHP version in semver format
|
|
|
|
php_semver() {
|
|
|
|
if [ ! "$version" = "8.0" ]; then
|
|
|
|
php"$version" -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-'
|
|
|
|
else
|
|
|
|
php -v | head -n 1 | cut -f 2 -d ' '
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Function to update PHP
|
|
|
|
update_php() {
|
|
|
|
update_ppa
|
|
|
|
initial_version=$(php_semver)
|
|
|
|
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1
|
|
|
|
updated_version=$(php_semver)
|
|
|
|
if [ "$updated_version" != "$initial_version" ]; then
|
|
|
|
status="Updated to"
|
|
|
|
else
|
|
|
|
status="Switched to"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-12-20 19:59:05 +07:00
|
|
|
# Variables
|
|
|
|
tick="✓"
|
|
|
|
cross="✗"
|
|
|
|
ppa_updated="false"
|
2020-01-27 21:36:04 +07:00
|
|
|
pecl_config="false"
|
2019-12-20 19:59:05 +07:00
|
|
|
version=$1
|
2020-02-09 05:38:48 +07:00
|
|
|
old_versions="5.[4-5]"
|
2020-02-14 00:09:00 +07:00
|
|
|
debconf_fix="DEBIAN_FRONTEND=noninteractive"
|
|
|
|
apt_install="sudo $debconf_fix apt-fast install -y"
|
2020-02-26 00:30:30 +07:00
|
|
|
tool_path_dir="/usr/local/bin"
|
2019-10-11 06:11:25 +07:00
|
|
|
existing_version=$(php-config --version | cut -c 1-3)
|
2020-02-16 01:55:50 +07:00
|
|
|
[[ -z "${update}" ]] && update='false' || update="${update}"
|
2019-12-20 19:59:05 +07:00
|
|
|
|
|
|
|
# Setup PHP
|
2019-12-27 08:26:49 +07:00
|
|
|
step_log "Setup PHP"
|
2020-02-09 05:38:48 +07:00
|
|
|
sudo mkdir -p /var/run /run/php
|
2019-12-20 19:59:05 +07:00
|
|
|
|
|
|
|
if [ "$existing_version" != "$version" ]; then
|
|
|
|
if [ ! -e "/usr/bin/php$version" ]; then
|
2020-01-30 13:33:30 +07:00
|
|
|
if [ "$version" = "8.0" ]; then
|
2019-12-20 19:59:05 +07:00
|
|
|
setup_master
|
2020-02-09 05:38:48 +07:00
|
|
|
elif [[ "$version" =~ $old_versions ]] || [ "$version" = "5.3" ]; then
|
|
|
|
setup_old_versions
|
2019-12-20 19:59:05 +07:00
|
|
|
else
|
2020-02-22 01:46:22 +07:00
|
|
|
update_ppa
|
2020-01-08 23:37:21 +07:00
|
|
|
$apt_install php"$version" php"$version"-curl php"$version"-mbstring php"$version"-xml >/dev/null 2>&1
|
2019-12-20 19:59:05 +07:00
|
|
|
fi
|
2020-02-14 00:09:00 +07:00
|
|
|
status="Installed"
|
2019-12-20 19:59:05 +07:00
|
|
|
else
|
2020-02-14 00:09:00 +07:00
|
|
|
if [ "$update" = "true" ]; then
|
2020-02-21 09:28:19 +07:00
|
|
|
update_php
|
2020-02-14 00:09:00 +07:00
|
|
|
else
|
|
|
|
status="Switched to"
|
|
|
|
fi
|
2019-12-20 19:59:05 +07:00
|
|
|
fi
|
|
|
|
|
2020-02-14 00:09:00 +07:00
|
|
|
# PHP 5.3 is switched by install script, for rest switch_version
|
2020-02-09 05:38:48 +07:00
|
|
|
if [ "$version" != "5.3" ]; then
|
|
|
|
switch_version
|
|
|
|
fi
|
2019-12-20 19:59:05 +07:00
|
|
|
|
2020-02-14 00:09:00 +07:00
|
|
|
else
|
|
|
|
if [ "$update" = "true" ]; then
|
2020-02-21 09:28:19 +07:00
|
|
|
update_php
|
2020-01-30 13:33:30 +07:00
|
|
|
else
|
2020-02-14 00:09:00 +07:00
|
|
|
status="Found"
|
2019-12-20 19:59:05 +07:00
|
|
|
fi
|
2020-02-14 00:09:00 +07:00
|
|
|
fi
|
2019-12-20 19:59:05 +07:00
|
|
|
|
2020-02-21 09:28:19 +07:00
|
|
|
semver=$(php_semver)
|
2019-10-17 03:11:13 +07:00
|
|
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
2020-02-09 05:38:48 +07:00
|
|
|
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
|
|
|
|
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
|
2020-02-26 00:30:30 +07:00
|
|
|
sudo chmod 777 "$ini_file" "$tool_path_dir"
|
2020-02-14 00:09:00 +07:00
|
|
|
add_log "$tick" "PHP" "$status PHP $semver"
|