No one can open PHP files in web browsers without a server. Page types such as HTML, Javascript and CSS can be understand by the browsers. But browsers can’t understand PHP. So the file will download.
There are two types of file that will run : Client-side and Server-side
Client Side : The program runs in browser itself. The client can easily access the code. The browser can understand the language in which the client program is written.
examples : HTML, CSS, JavaScript, jQuery, AngularJS
Server Side : The program runs in server and the finished page is sent to the client’s browser. The returned page won’t contain any source code of the language ie the client won’t see the code in page source unlike in Client Side. The returned page won’t contain any server language at all.
So now you got the reason why the PHP file won’t open in web browsers. You can only open PHP file with a server that supports PHP language. So here’s how to install Apache server and configure the server in Ubuntu
Posts marked with "PHP" in categories