Skip to content
Permalink
Browse files

update to PHP 7.2

* drop the ondrej/php PPA since PHP 7.x is available directly from Ubuntu 18.04
* intall PHP 7.2 which is just the "php" package in Ubuntu 18.04
* some package names changed, some unnecessary packages are no longer provided
* update paths
  • Loading branch information
JoshData committed Aug 24, 2018
1 parent f6a641a commit bbfa01f33ae14d1ecfb2bca24aed7b607d1d638f
Showing with 28 additions and 45 deletions.
  1. +1 −1 conf/nginx-top.conf
  2. +2 −2 management/backup.py
  3. +10 −10 setup/nextcloud.sh
  4. +0 −12 setup/system.sh
  5. +6 −9 setup/web.sh
  6. +4 −4 setup/webmail.sh
  7. +3 −3 setup/zpush.sh
  8. +2 −4 tools/owncloud-restore.sh
@@ -7,6 +7,6 @@
## your own --- please do not ask for help from us.

upstream php-fpm {
server unix:/var/run/php/php7.0-fpm.sock;
server unix:/var/run/php/php7.2-fpm.sock;
}

@@ -267,7 +267,7 @@ def service_command(service, command, quit=None):
if quit:
sys.exit(code)

service_command("php7.0-fpm", "stop", quit=True)
service_command("php7.2-fpm", "stop", quit=True)
service_command("postfix", "stop", quit=True)
service_command("dovecot", "stop", quit=True)

@@ -301,7 +301,7 @@ def service_command(service, command, quit=None):
# Start services again.
service_command("dovecot", "start", quit=False)
service_command("postfix", "start", quit=False)
service_command("php7.0-fpm", "start", quit=False)
service_command("php7.2-fpm", "start", quit=False)

# Once the migrated backup is included in a new backup, it can be deleted.
if os.path.isdir(migrated_unencrypted_backup_dir):
@@ -11,9 +11,9 @@ echo "Installing Nextcloud (contacts/calendar)..."

apt-get purge -qq -y owncloud* # we used to use the package manager

apt_install php7.0 php7.0-fpm \
php7.0-cli php7.0-sqlite php7.0-gd php7.0-imap php7.0-curl php-pear php-apc curl \
php7.0-dev php7.0-gd php7.0-xml php7.0-mbstring php7.0-zip php7.0-apcu php7.0-json php7.0-intl
apt_install php php-fpm \
php-cli php-sqlite3 php-gd php-imap php-curl php-pear curl \
php-dev php-gd php-xml php-mbstring php-zip php-apcu php-json php-intl

InstallNextcloud() {

@@ -83,7 +83,7 @@ if [ ! -d /usr/local/lib/owncloud/ ] \
|| ! grep -q $nextcloud_ver /usr/local/lib/owncloud/version.php; then

# Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail.
service php7.0-fpm stop &> /dev/null || /bin/true
service php7.2-fpm stop &> /dev/null || /bin/true

# Backup the existing ownCloud/Nextcloud.
# Create a backup directory to store the current installation and database to
@@ -244,7 +244,7 @@ if [ \( $? -ne 0 \) -a \( $? -ne 3 \) ]; then exit 1; fi

# Set PHP FPM values to support large file uploads
# (semicolon is the comment character in this file, hashes produce deprecation warnings)
tools/editconf.py /etc/php/7.0/fpm/php.ini -c ';' \
tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \
upload_max_filesize=16G \
post_max_size=16G \
output_buffering=16384 \
@@ -253,7 +253,7 @@ tools/editconf.py /etc/php/7.0/fpm/php.ini -c ';' \
short_open_tag=On

# Set Nextcloud recommended opcache settings
tools/editconf.py /etc/php/7.0/cli/conf.d/10-opcache.ini -c ';' \
tools/editconf.py /etc/php/7.2/cli/conf.d/10-opcache.ini -c ';' \
opcache.enable=1 \
opcache.enable_cli=1 \
opcache.interned_strings_buffer=8 \
@@ -263,12 +263,12 @@ tools/editconf.py /etc/php/7.0/cli/conf.d/10-opcache.ini -c ';' \
opcache.revalidate_freq=1

# Configure the path environment for php-fpm
tools/editconf.py /etc/php/7.0/fpm/pool.d/www.conf -c ';' \
tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \
env[PATH]=/usr/local/bin:/usr/bin:/bin

# If apc is explicitly disabled we need to enable it
if grep -q apc.enabled=0 /etc/php/7.0/mods-available/apcu.ini; then
tools/editconf.py /etc/php/7.0/mods-available/apcu.ini -c ';' \
if grep -q apc.enabled=0 /etc/php/7.2/mods-available/apcu.ini; then
tools/editconf.py /etc/php/7.2/mods-available/apcu.ini -c ';' \
apc.enabled=1
fi

@@ -290,4 +290,4 @@ chmod +x /etc/cron.hourly/mailinabox-owncloud
# ```

# Enable PHP modules and restart PHP.
restart_service php7.0-fpm
restart_service php7.2-fpm
@@ -121,18 +121,6 @@ apt_install python3 python3-dev python3-pip \
haveged pollinate unzip \
unattended-upgrades cron ntp fail2ban

# ### Add PHP7 PPA

# Nextcloud requires PHP7, we will install the ppa from ubuntu php maintainer Ondřej Surý
# The PPA is located here https://launchpad.net/%7Eondrej/+archive/ubuntu/php
# Unattended upgrades are activated for the repository If it appears it's already
# installed, don't do it again so we can avoid an unnecessary call to apt-get update.
if [ ! -f /etc/apt/sources.list.d/ondrej-php-trusty.list ]; then
hide_output add-apt-repository -y ppa:ondrej/php
apt_add_repository_to_unattended_upgrades LP-PPA-ondrej-php:trusty
hide_output apt-get update
fi

# ### Suppress Upgrade Prompts
# When Ubuntu 20 comes out, we don't want users to be prompted to upgrade,
# because we don't yet support it.
@@ -19,10 +19,7 @@ fi

echo "Installing Nginx (web server)..."

apt_install nginx php7.0-cli php7.0-fpm

# Set PHP7.0 as the default since several versions are available.
update-alternatives --set php /usr/bin/php7.0
apt_install nginx php-cli php-fpm

rm -f /etc/nginx/sites-enabled/default

@@ -44,19 +41,19 @@ tools/editconf.py /etc/nginx/nginx.conf -s \
server_names_hash_bucket_size="128;"

# Tell PHP not to expose its version number in the X-Powered-By header.
tools/editconf.py /etc/php/7.0/fpm/php.ini -c ';' \
tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \
expose_php=Off

# Set PHPs default charset to UTF-8, since we use it. See #367.
tools/editconf.py /etc/php/7.0/fpm/php.ini -c ';' \
tools/editconf.py /etc/php/7.2/fpm/php.ini -c ';' \
default_charset="UTF-8"

# Switch from the dynamic process manager to the ondemand manager see #1216
tools/editconf.py /etc/php/7.0/fpm/pool.d/www.conf -c ';' \
tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \
pm=ondemand

# Bump up PHP's max_children to support more concurrent connections
tools/editconf.py /etc/php/7.0/fpm/pool.d/www.conf -c ';' \
tools/editconf.py /etc/php/7.2/fpm/pool.d/www.conf -c ';' \
pm.max_children=8

# Other nginx settings will be configured by the management service
@@ -96,7 +93,7 @@ chown -R $STORAGE_USER $STORAGE_ROOT/www

# Start services.
restart_service nginx
restart_service php7.0-fpm
restart_service php7.2-fpm

# Open ports.
ufw_allow http
@@ -22,8 +22,8 @@ source /etc/mailinabox.conf # load global vars
echo "Installing Roundcube (webmail)..."
apt_install \
dbconfig-common \
php7.0-cli php7.0-sqlite php7.0-mcrypt php7.0-intl php7.0-json php7.0-common php7.0-curl \
php7.0-gd php7.0-pspell tinymce libjs-jquery libjs-jquery-mousewheel libmagic1 php7.0-mbstring
php-cli php-sqlite3 php-intl php-json php-common php-curl \
php-gd php-pspell tinymce libjs-jquery libjs-jquery-mousewheel libmagic1 php-mbstring

# Install Roundcube from source if it is not already present or if it is out of date.
# Combine the Roundcube version number with the commit hash of plugins to track
@@ -193,5 +193,5 @@ chown www-data:www-data $STORAGE_ROOT/mail/roundcube/roundcube.sqlite
chmod 664 $STORAGE_ROOT/mail/roundcube/roundcube.sqlite

# Enable PHP modules.
phpenmod -v php7.0 mcrypt imap
restart_service php7.0-fpm
phpenmod -v php mcrypt imap
restart_service php7.2-fpm
@@ -17,9 +17,9 @@ source /etc/mailinabox.conf # load global vars

echo "Installing Z-Push (Exchange/ActiveSync server)..."
apt_install \
php7.0-soap php7.0-imap libawl-php php7.0-xsl
php-soap php-imap libawl-php php-xsl

phpenmod -v php7.0 imap
phpenmod -v php imap

# Copy Z-Push into place.
VERSION=2.4.4
@@ -102,7 +102,7 @@ EOF

# Restart service.

restart_service php7.0-fpm
restart_service php7.2-fpm

# Fix states after upgrade

@@ -26,8 +26,7 @@ if [ ! -f $1/config.php ]; then
fi

echo "Restoring backup from $1"
service php5-fpm stop
service php7.0-fpm stop
service php7.2-fpm stop

# remove the current ownCloud/Nextcloud installation
rm -rf /usr/local/lib/owncloud/
@@ -46,6 +45,5 @@ chown www-data.www-data $STORAGE_ROOT/owncloud/config.php

sudo -u www-data php /usr/local/lib/owncloud/occ maintenance:mode --off

service php5-fpm start
service php7.0-fpm start
service php7.2-fpm start
echo "Done"

0 comments on commit bbfa01f

Please sign in to comment.
You can’t perform that action at this time.