- Update apparmor rules
curl -L https://gist.github.com/raw/67672ea297213b830e876c5489c06b99 > /etc/apparmor.d/abstractions/php7
curl -L https://gist.github.com/raw/89af8525ebfbe2ad36d755d5a8b21bdd > /etc/apparmor.d/usr.sbin.php-fpm7.0
curl -L https://gist.github.com/raw/d97677cb51b7b23641e6ed9f8bcfd674 > /etc/apparmor.d/usr.sbin.nginx
service apparmor reload
- Install php7
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.0-cli php7.0-common php7.0-curl php7.0-dev php7.0-fpm php7.0-gd php7.0-json php7.0-ldap php7.0-mcrypt php7.0-memcache php7.0-mysql php7.0-readline php7.0-redis php7.0-opcache php7.0-xml php7.0-mbstring php7.0-dba php7.0-bcmath php7.0-bz2 php7.0-soap php7.0-zip php7.0-xsl
- Copy new php conf file
curl -L https://gist.github.com/raw/29fa84328fedcba184dd4cb7bf0c730c > /etc/php/7.0/fpm/php.ini
curl -L https://gist.github.com/raw/f0aa7941199686b45ff1742013688f59 > /etc/php/7.0/fpm/pool.d/www.conf
curl -L https://gist.github.com/raw/229bdad5d7a039bd91a7d68abcfaca4f > /etc/php/7.0/fpm/conf.d/10-opcache.ini
- Rollback to php5 cli if needet:
update-alternatives --list php
update-alternatives --set php /usr/bin/php5
- re-install new relic agent
apt-get install newrelic-php5
update newrelic.license in /etc/php/7.0/mods-available/newrelic.ini (see "old" ini file) restart newrelic daemon
service newrelic-daemon restart
- Prepare new configs:
cp /etc/nginx/include/fastcgi.conf /etc/nginx/include/fastcgi-php7.conf
sed -i -e 's/fastcgi_pass\ 127\.0\.0\.1:9000;/fastcgi_pass\ unix:\/run\/php\/php7\.0-fpm\.sock;/g' /etc/nginx/include/fastcgi-php7.conf
cp /etc/nginx/include/nexus.conf /etc/nginx/include/nexus-php7.conf
sed -i -e 's/include\ include\/fastcgi\.conf;/include\ include\/fastcgi-php7\.conf;/g' /etc/nginx/include/nexus-php7.conf
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.php5
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.php7
sed -i -e 's/include\ include\/nexus\.conf;/include\ include\/nexus-php7\.conf;/g' /etc/nginx/nginx.conf.php7
- Replace main nginx config file
cp /etc/nginx/nginx.conf.php7 /etc/nginx/nginx.conf
- Restart php-fpm, nginx
service php7.0-fpm restart
service nginx restart
service php5-fpm stop
- Fast-rollback:
cp /etc/nginx/nginx.conf.php5 /etc/nginx/nginx.conf
- Restart php-fpm, nginx
service php5-fpm restart
service nginx restart
service php7.0-fpm stop