I
I
Ivan Shumakov2017-10-18 22:58:53
LAMP
Ivan Shumakov, 2017-10-18 22:58:53

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

3 answer(s)
S
Saboteur, 2017-10-18
@saboteur_kiev

"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

E
Egor, 2017-10-18
@egormmm

1. Remove the file:// lines
as well 2. The file extension with the script is most often .php and not .html

V
Vasily Petrov, 2017-10-19
@ratha

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 question

Ask a Question

731 491 924 answers to any question