Question

php not working, just rendering code

Posted November 30, 2016 4.3k views
PHPUbuntu 16.04

I have installed a server yesterday following this tutorial at https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04, and after much work it worked. Then I deleted a couple folders by mistake. No big deal, I’ll reinstall everything from scratch. And so far so good… until I tried to install php. Apparently, it’s installed, but it renders the code and nothing else. If I use php -v, it says 5.6 is installed. I tried installing php7 to see if that solved the problem, following the instructions at https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04, but nothing

Just in case, based in another similar question, if I do /etc/php$ ls -l /etc/apache2/mods*/php*

then I get this

lrwxrwxrwx 1 root root  11 Nov 30 22:23 /etc/apache2/mods-available/php7.0.conf -> php7.0.conf
lrwxrwxrwx 1 root root  11 Nov 30 22:24 /etc/apache2/mods-available/php7.0.load -> php7.0.load
-rw-r--r-- 1 root root 133 Nov 30 21:55 /etc/apache2/mods-available/php.conf
-rw-r--r-- 1 root root  59 Nov 30 21:55 /etc/apache2/mods-available/php.load
fabio@evankimbrell:/etc/php$ /etc/php$ ls -l /etc/apache2/mods*/php*

Please, I really need help on this!

EDIT: just in case it’s of help, I see the rendered code in Chrome, and a blank page on Firefox. And additionally, php -vsays I’m still on 5.6 :(

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Did you restart Apache after installing PHP? :)

Submit an Answer