34,333
edits
Changes
→How Does PHP Work?
Typically the web server doesn't pay any attention to the content of the file it has just transmitted to the web browser. As far the web server is concerned the web browser understands the content of the web page file and knows how to interpret and render it so that it appears as the web designer intended.
Now let's consider what kind of web page content a web browser understands. These days a web page is likely to consist of HTML, XHTML and JavaScript. The web browser contains code that tells it what to do with these types of content. For example, it understands the structure HTML in terms of rendering the page, and it has a JavaScript interpreter built in that know how to execute the instruction in a JavaScript script. A web browser, however, knows absolutely nothing about any PHP script that may be embeeded in an HTML document. if If a brwoser browser was serverd a web page containing PHP it would not know how to interpreet interpret that code.
Given that a web browser knows nothing about PHP in a web page, then clearly something has to be doen with any PHP script in the page before it reaches the browser. This is where the PHP pre-processing module comes in. The PHP module is integrated into the web server. The module tells the web server that when a page is to served that contains PHP script (identified by special markers) that it is pass that script to the PHP pre-processing module and wait. The PHP processing module understands PHP, executes the PHP script written by the web developer.