php not working, just rendering code

November 30, 2016 2.2k views
PHP Ubuntu 16.04

I have installed a server yesterday following this tutorial at, 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, 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 :(

1 Answer

Did you restart Apache after installing PHP? :)

  • yes, many times, both restart and reload. I just used it again just in case, to no avail

    sudo systemctl restart apache2
    • Do you know exactly which folders you deleted?

      • not sure, but might be the binaries one. Either way, I tried adding the binaries from scratch (and worked) but maybe I'm missing some folder or something?

        • Do you have any critical data on the server?

          Your best option might be starting fresh. The problem you're experiencing is rather simple (most likely Apache incorrectly configured) but there's a few unknowns (like the deleted folders) which makes it hard to help.

Have another answer? Share your knowledge.