2

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"; ?> not test. Wat do?

user3743266
  • 1,124
  • 4
  • 16
  • 28

3 Answers3

3

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
Alex Blex
  • 34,704
  • 7
  • 48
  • 75
1

Are you opening your file directly or running inside the Apache web server folder? (example: you'll must access http://localhost/nameofthefile.php in the browser)

Does your file have the ".php" extension?

0

If will most probably be your you Nginx or Apache settings?

The guide below should help you out.

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04?utm_source=legacy_reroute

hawx
  • 1,629
  • 5
  • 21
  • 37