Previewing file just shows the code


#1

I was trying to connect using python, without any success. I tried following this just to see if it’s working for php. To my surprise, I couldn’t get this to work. After following these steps, the apache url is giving me the code instead of the output. Please advise if I’m doing anything wrong.


Connecting PHP to MySQL
#2

Sounds like you’re previewing the raw file when you should be previewing the running application. This is similar to opening a PHP file on your computer by double clicking it and then seeing it open in Chrome/Firefox. It will probably just show the code or ask you if you want to download the file.

In order to see the output of the actually script/file running, you need to make sure to run it with Apache (or whatever server you want to use) and then use “Preview running application” to see it running on the server.


#3

this also can happen if php is not installed