Jump to content

Archived

This topic is now archived and is closed to further replies.

sneskid

PHP insight

Recommended Posts

I've been needing some insight as to how PHP scripts are handled after they are "compiled" and so forth.
Here is a prolonged scenario... mostly how I understand PHP to currently work, or I should say the code behind the scenes that makes PHP work.

terms:
Let Access(name.php) mean someone from the web has accessed the file in the brackets
Let [#] represent an instance of the script
Let Finish[#] mean the script finaly finished running
Let Update(name.php) mean that script was changed somehow

Let - represent a statement to describe the scenario
Let * represent an action
Let ? represent a question I have

== The Scenario ==

- We just uploaded a PHP file called "snes.php"

*Access(snes.php) [1]
- This is the first time snes.php is accessed, so it will get compiled by the zend engine, then it should be in memory.
*Finish[1]

*Access(snes.php) [2]
- This time snes.php is already in memory, so it starts to do what it has to do quicker.

? Is Zend informed when a file is updated or does it check the file every time someone accesses it

- Due to requests user [2] made, snes.php will run a loop that may take a few seconds to complete.

*Update(snes.php)
- I make snes.php include another file called "kid.php"

*Access(snes.php) [3]
- The zend engine recognizes snes.php was altered, so it recompiles it.
- The zend engine also compiles kid.php because it is included by snes.php.
- a few seconds pass

? What happens to instance [2] that ran during this time? would it just live out it's course? or is the process somehow interrupted.

*Finish[2]
*Finish[3]

*Access(snes.php) [4]
- user[4] has made some requests that make snes.php run for a few seconds.
* Update(kid.php)
- We made snes.php smart, so it knows if kid.php has been updated, and it can decide to re-include kid.php
? is "re-including" even possible?
? what happens to class objects that already existed and became available from an older include
? will PHP recompile kid.php again for instance [4] of snes.php, or just use what's in memory from before

*Finish[4]



== Thanks ==

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.