dev-scripts/dev-production-universal/scripts/debian10/install-php.sh

38 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
if [ "$php_version" != 'latest' ] ; then
echo 'ERROR: unable to install PHP - only '"'latest'"' version currently supported'
exit 30
fi
# check we have ssh access
[ -z "$ssh_root" ] && echo "Error: no root ssh configuration specified" && exit 5
if [ -n "$wp_user" ] ; then
echo 'Installing PHP for WordPress ...'
ssh -T $ssh_root << 'EOSSH'
export DEBIAN_FRONTEND=noninteractive
echo "Installing packages .."
apt-get install -qq -y php libapache2-mod-php php-fpm php-bcmath php-curl php-gd php-imagick php-mbstring \
php-mysql php-soap php-xml php-zip
echo "Packages installed"
_php_config_file=$(php --ini | grep Loaded | awk '{ print $4 }')
sed -i '/memory_limit/c\memory_limit = 256M' "$_php_config_file"
sed -i '/upload_max_filesize/c\upload_max_filesize = 64M' "$_php_config_file"
sed -i '/post_max_size/c\post_max_size = 64M' "$_php_config_file"
sed -i '/max_execution_time/c\max_execution_time = 300M' "$_php_config_file"
sed -i '/max_input_time/c\max_input_time = 1000' "$_php_config_file"
EOSSH
else
echo 'Installing default PHP ...'
ssh -T $ssh_root << EOSSH
export DEBIAN_FRONTEND=noninteractive
echo "Installing packages .."
apt-get install -qq -y php libapache2-mod-php php-mysql
echo "Packages installed"
EOSSH
fi