When I try to run a php program in the browser the php file is downloaded instead of executed.
Asked
Active
Viewed 2,564 times
1 Answers
2
You need to have a web server that executes the php script. PHP is a server side language.
On ubuntu this may be done with apache:
sudo apt-get install apache2 libapache2-mod-php7.0
Should set you up with apache.
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04 provides more information on how to set it up properly, including where to place the content to be served.

vidarlo
- 22,691