Answer the question
In order to leave comments, you need to log in
What should I do if the PHP code file is not being executed, but is being loaded?
I'm trying to learn PHP, and I have a problem at the very first steps: I'm making a test page that should refer to a file with a script. But the code is not executed, instead the browser offers to save the page. Can you please tell me what to do?
In the address bar I write the following path:
file://localhost/home/ivan/Documents/My%20learning/php/1/sayHelloWeb.html
Answer the question
In order to leave comments, you need to log in
"file://localhost/home/ivan/Documents/My%20learning/php/1/sayHelloWeb.html"
With this call, the browser will simply open the html file.
The browser cannot execute php code, it is executed by the php interpreter.
Therefore, you need to either install php and run it through it, for example
php.exe ,
or install a web server with the php module, and then open it through the web server (http/https), but not through file .
In addition, the .html file extension says that this is not a script, but an html page
1. Remove the file:// lines
as well 2. The file extension with the script is most often .php and not .html
Install www.denwer.ru or an equivalent, since the browser cannot read php.
If there is a php server, then the path will be relative to it (domain/.../ .../).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question