why is my browser not running php files code example
Example 1: php showing code in browser
If your PHP code is being displayed in the browser, it means that your
server has not been setup to serve PHP scripts.
You can use something like XAMPP. If you do, activate 'Apache' and 'MySQL'
After you do that, go into the download directory and go into 'htdocs'
(default: 'C:\xampp\htdocs')
Make a folder with your PHP code in it.
To access the website, go into your browser and type:
localhost/FOLDER_NAME_WITH_PHP_HERE
NOTE:
this will only allow you to view it locally, nobody else will be able
to see the website.
Example 2: on running php file showing code instead of view
sudo apt-get install php libapache2-mod-php
sudo a2enmod mpm_prefork && sudo a2enmod php7.0
sudo service apache2 restart