Fix to issue #76 - Use php5 for some dists with new command-line switch (#77)

* added special option --use-php5-package

* parse options and export new environment variable USE_PHP5_PACKAGE

* added choice between php5* or php7.0* packages (recommited)

* fixed php*-fpm service name and php.ini file path (recommited)

* prepare socket name for nginx to work with php5-fpm or php7.0-fpm (recommited)

* added ppa:ondrej/php5-compat repo

* added dependency ppa:ondrej/php repo and package software-properties-common
This commit is contained in:
erxspin
2017-02-28 22:32:26 +06:00
committed by FusionPBX
parent b517884450
commit 7cd7859a90
4 changed files with 54 additions and 10 deletions

View File

@@ -12,17 +12,31 @@ verbose "Installing the web server"
arch=$(uname -m)
real_os=$(lsb_release -is)
codename=$(lsb_release -cs)
if [ $real_os = 'Ubuntu' ]; then
if [ .$USE_SWITCH_PACKAGE_UNOFFICIAL_ARM = .true ]; then
#9.x - */stretch/
#8.x - */jessie/
if [ .$codename = .'jessie' ]; then
USE_PHP5_PACKAGE = true
fi
fi
if [ .$USE_PHP5_PACKAGE = .true ]; then
#don't add php7.0 repository
verbose "Switching forcefully to php5* packages"
which add-apt-repository || apt-get install -y software-properties-common
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php5-compat
elif [ .$real_os = .'Ubuntu' ]; then
#16.10.x - */yakkety/
#16.04.x - */xenial/
#14.04.x - */trusty/
if [ $codename = 'trusty' ]; then
if [ .$codename = .'trusty' ]; then
which add-apt-repository || apt-get install -y software-properties-common
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
fi
else
#9.x - */stretch/
#8.x - */jessie/
if [ $codename = 'jessie' ]; then
if [ .$codename = .'jessie' ]; then
echo "deb http://packages.dotdeb.org $codename all" > /etc/apt/sources.list.d/dotdeb.list
echo "deb-src http://packages.dotdeb.org $codename all" >> /etc/apt/sources.list.d/dotdeb.list
wget -O - https://www.dotdeb.org/dotdeb.gpg | apt-key add -
@@ -31,10 +45,21 @@ fi
apt-get update
#install dependencies
apt-get install -y nginx php7.0 php7.0-cli php7.0-fpm php7.0-pgsql php7.0-sqlite3 php7.0-odbc php7.0-curl php7.0-imap php7.0-mcrypt php7.0-xml
apt-get install -y nginx
if [ .$USE_PHP5_PACKAGE = .true ]; then
apt-get install -y php5 php5-cli php5-fpm php5-pgsql php5-sqlite php5-odbc php5-curl php5-imap php5-mcrypt
else
apt-get install -y php7.0 php7.0-cli php7.0-fpm php7.0-pgsql php7.0-sqlite3 php7.0-odbc php7.0-curl php7.0-imap php7.0-mcrypt php7.0-xml
fi
#enable fusionpbx nginx config
cp nginx/fusionpbx /etc/nginx/sites-available/fusionpbx
#prepare socket name
if [ .$USE_PHP5_PACKAGE = .true ]; then
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php5-fpm.sock;#g'
else
sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.0-fpm.sock;#g'
fi
ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbx
#self signed certificate