Monday, September 26, 2016

Why My PHP Code Showing in Browser?

This is my small notes for self-reminder. I've been experiencing this problem after setup new environment for web development. Although I'll always found the solution, I'm blaming myself once this same problem raise again: why I don't remember this super basic principle? So, I'll leave this tips here, hopefully will be useful to others.

What's actually happen here? So, basically, after installing apache and php, if you open your PHP file, you'll hope that browser will execute it and display rendered HTML. Then, you surprised that browser display PHP code instead. So, if you're facing this problem right now, try to run this command in terminal/console: (in this case, I'm using Debian. It's should be compatible with Ubuntu, for example).
sudo apt-get install php5 libapache2-mod-php5
Once finished, restart apache. Your problem should be fixed by now (hopefully).

Related Articles

0 comments:

Post a Comment