From bbfa01f33ae14d1ecfb2bca24aed7b607d1d638f Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Fri, 24 Aug 2018 08:46:08 -0400 Subject: [PATCH] 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 --- conf/nginx-top.conf | 2 +- management/backup.py | 4 ++-- setup/nextcloud.sh | 20 ++++++++++---------- setup/system.sh | 12 ------------ setup/web.sh | 15 ++++++--------- setup/webmail.sh | 8 ++++---- setup/zpush.sh | 6 +++--- tools/owncloud-restore.sh | 6 ++---- 8 files changed, 28 insertions(+), 45 deletions(-) diff --git a/conf/nginx-top.conf b/conf/nginx-top.conf index a5822a82..4d888366 100644 --- a/conf/nginx-top.conf +++ b/conf/nginx-top.conf @@ -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; } diff --git a/management/backup.py b/management/backup.py index 8081a267..78af6a19 100755 --- a/management/backup.py +++ b/management/backup.py @@ -267,7 +267,7 @@ def perform_backup(full_backup): 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 perform_backup(full_backup): # 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): diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index ed67dbf3..0105668c 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -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 diff --git a/setup/system.sh b/setup/system.sh index 32cf9987..5dea1f45 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -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. diff --git a/setup/web.sh b/setup/web.sh index 45227b81..ed37e5e3 100755 --- a/setup/web.sh +++ b/setup/web.sh @@ -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 diff --git a/setup/webmail.sh b/setup/webmail.sh index 9b2591e2..58743a72 100755 --- a/setup/webmail.sh +++ b/setup/webmail.sh @@ -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 diff --git a/setup/zpush.sh b/setup/zpush.sh index 84ab4556..32fc4992 100755 --- a/setup/zpush.sh +++ b/setup/zpush.sh @@ -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 diff --git a/tools/owncloud-restore.sh b/tools/owncloud-restore.sh index 1b006ca1..c93a322c 100755 --- a/tools/owncloud-restore.sh +++ b/tools/owncloud-restore.sh @@ -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"