How Do You Troubleshoot a PHP Page Showing the Raw Code in a Web Browser?

Problem scenario
You created a PHP web page, but it is not rendering correctly in a web browser.  You see the raw PHP code or text.  What do you do to get the PHP to display correctly as a web UI (and not raw code and uninterpreted text)?

Solution
Possible solution #1
Install PHP.  For assistance with installing it on a Debian/Ubuntu server, see this posting.  For assistance with installing it on CentOS/RHEL/Fedora, see this posting.

Possible solution #2
If you are using a Debian derivative of Linux, install libapache2-mod-php.  Here is the command that you would run (either with a sudo in front of it or as root):

apt-get -y install libapache2-mod-php

Leave a comment

Your email address will not be published. Required fields are marked *