How PHP works?
The most famous website Facebook was developed in PHP and still using PHP, except that they are converting the PHP code executed to C++ code for performance. They call it HiphopPHP. You might want to check about HiphopPHP on Github.
Let’s get to the point on how PHP works? Above is the slide show that i made to show you guys how PHP works.
Normally when a user or the client machine requests a page to the web server the server responds to the request by sending the requested page to the client machine. This process is simple if it is a normal HTML page. What if the requested page is a dynamically generated page like PHP. In that case the web server again requests that particular page following these steps.
Another case is that when a requested page needs information to be retrieved from the database. In that case the PHP script engine will do the work for us, but of-course we should write the code for connecting to the database. That process is show in the third slide of the above presentation.
For this kind of requests step 1 and 2 is same as shown above.