Jump to content

PHP insight


sneskid

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 ==
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.