user3743266 user3743266 - 1 year ago 178
PHP Question

Installing PHP 7 on digitalocean

I'm trying to use PHP 7 on digitalocean but the scripts inside files won't run.

This is what I used for install:

sudo apt-get install php7 libapache2-mod-php7 php7-mcrypt

I can do php --version and I get:

PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies

But when I check a file with
<?php echo "test"; ?>
on the browser it just shows
<?php echo "test"; ?>
. Wat do?

Answer Source

It is php7.0 not php7. Just checked on DO Ubuntu 16.04.1 x64 image:

apt-get install apache2
apt-get -y install php7.0 libapache2-mod-php7.0 php7.0-mcrypt
systemctl restart apache2
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download