php cannot be run directly because php is a general open source scripting language, a programming language that cannot be directly recognized by the browser, so the PHP file must be parsed by the server before it can be browsed on the browser. If this A machine cannot run without a running environment.
Why can’t php be run directly?
Because Php is a general open source scripting language and a programming language; it cannot be directly recognized by the browser, and the PHP file must be parsed by the server (for example: Apache) before it can be browsed on the browser. If the machine does not have a running environment, it cannot run.
If you directly right-click the file and open it with a browser, it will not be parsed by Apache, which is equivalent to directly opening a local PHP file with a browser. The browser cannot directly recognize it and will prompt you to download the file. , or other questions. For details, please refer to: What is PHP, this article!
The above is the detailed content of Why can't php be run directly?. For more information, please follow other related articles on the PHP Chinese website!