augr
augr

Reputation: 47

Upgrade/install php7 on google compute cloud instance

I'm trying to upgrade my google cloud compute instance with the latest version of php.

It is currently is running debian9/php5/apache2/mysql14 and I want to get it to php7.

I've tried all the simple apt-get update upgrade install php7 etc and no packages are found.

E: Unable to locate package php7.0

E: Couldn't find any package by regex 'php7.0'

E: Unable to locate package libapache2-mod-php7.0

E: Couldn't find any package by regex 'libapache2-mod-php7.0'

E: Unable to locate package php7.0-mysql

E: Couldn't find any package by regex 'php7.0-mysql'

E: Unable to locate package php-common

E: Unable to locate package php7.0-cli

E: Couldn't find any package by regex 'php7.0-cli'

E: Unable to locate package php7.0-common

E: Couldn't find any package by regex 'php7.0-common'

E: Unable to locate package php7.0-json

E: Couldn't find any package by regex 'php7.0-json'

E: Unable to locate package php7.0-opcache

E: Couldn't find any package by regex 'php7.0-opcache'

E: Unable to locate package php7.0-readline

E: Couldn't find any package by regex 'php7.0-readline'

I've also tried 7.1 and 7.2 and same thing. Ideally the latest version of php but I'll take anything at this point.

Thanks for any help!

p.s. this will primarily run WordPress sites.

Upvotes: 0

Views: 1644

Answers (1)

augr
augr

Reputation: 47

Here's how to do it is anyone else needs to get this done. I'm on Debian 8 I mistakenly said 9 in my post.

Instructions: https://shiji.info/uncategorized/install-php7-on-debian-8-jessie-with-apache_99/

Before the final step of the instructions, I had to add these two steps:

sudo a2enmod proxy_fcgi setenvif

sudo a2enconf php7.0-fpm

Here are the instructions from the link above:

Install PHP7:
Since PHP7 is not included in any Debian official source list, we gonna use         the version compiled by Dotdeb.org, which is pretty widely used.

Add source:

sudo nano /etc/apt/sources.list
Add the following two lines to the end of the file:

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all
If you server is far from US, try find the nearest mirror:         https://www.dotdeb.org/mirrors/

Get and Install GnuPG key:

wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
Update packages again

sudo apt-get update
Install PHP7:

here is a list of available packages currently: (By the way, Swoole also     work with php7, use ‘pecl install swoole to install’)

php7.0-apcu       php7.0-dbg        php7.0-imagick    php7.0-memcached      php7.0-phpdbg     php7.0-sybase
php7.0-apcu-bc    php7.0-dev        php7.0-imap       php7.0-mongodb        php7.0-pspell     php7.0-tidy
php7.0-bz2        php7.0-enchant    php7.0-interbase  php7.0-msgpack    php7.0-readline   php7.0-xdebug
php7.0-cgi        php7.0-fpm        php7.0-intl       php7.0-mysql          php7.0-recode     php7.0-xmlrpc
php7.0-cli        php7.0-gd         php7.0-json       php7.0-odbc       php7.0-redis      php7.0-xsl
php7.0-common     php7.0-gmp        php7.0-ldap       php7.0-opcache    php7.0-snmp
php7.0-curl       php7.0-igbinary   php7.0-mcrypt     php7.0-pgsql      php7.0-sqlite3
Choose your list of mod, install with php

sudo apt-get install php7.0 php7.0-common php-pear #add your list of mods here
Install mod_php7 for Apache 2.4 and restart apache:

sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart
That’s it! Done!

Upvotes: 3

Related Questions