Jump to content

Archived

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

sneskid

quick questions

Recommended Posts

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

2: What happens to scripts that are already running if their source PHP file is updated?

3: What happens to scripts that include another php file, and then the included file's source php gets updated? Can the script "re-include" that file again while running?

Share this post


Link to post
Share on other sites
Are you sure you understand how php works?

PHP is processed server side. Data is only sent to the browser after processing or until you break off from the php script.

Your script is not processing indefinitely. Everytime a script runs it loads all the includes called for it.

Share this post


Link to post
Share on other sites
[!--quoteo(post=364667:date=Apr 13 2006, 11:27 PM:name=jworisek)--][div class=\'quotetop\']QUOTE(jworisek @ Apr 13 2006, 11:27 PM) [snapback]364667[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Are you sure you understand how php works?

PHP is processed server side. Data is only sent to the browser after processing or until you break off from the php script.

Your script is not processing indefinitely. Everytime a script runs it loads all the includes called for it.
[/quote]

I know the scripts don't run indefinately. They do what they do and then they stop. I'm just curious how the engine checks if a source file was updated, and how this effects scripts already running that were based on those source files.

if I have a file test.php and it has
<? php echo "one" ?>
when I go to it ill just see 1 on my browser window

If I update the file to be
<? php echo "two" ?>
and I go to it i should see 2 on my browser window, but sometimes this change takes a few seconds to happen.

I wanna know how PHP handles these updates.

Share this post


Link to post
Share on other sites
PHP isn't compiled code, so it doesn't need to check for updates. Files will run regardless of their last updates, the Processor doesn't care about updates.

The update taking a few seconds could just be your cache loading the file. You should do a CTRL+Refresh when you update the files as it'll grab the latest copy of the file from the server.

C

Share this post


Link to post
Share on other sites
I know PHP code isn't actualy compiled, was just using that to get the idea accross. PHP is an interpreted language.

So does the php engine just keep re-enterpreting the file every time someone accesses it? Reading the file from HD every time?

Share this post


Link to post
Share on other sites
yep, precisely.

Thats why its important to have well written code. Especially on big sites.

C

Share this post


Link to post
Share on other sites
ouchie

I was under the false impression the PHP engine keeps a "prepped&ready" copy of the script ready in memory... which would have been nice.

So then it would make sense to use short variable names and keep comments out of the final final draft.. right?

Share this post


Link to post
Share on other sites
You can write code that is kept in a cache, but thats outside of my knowledge. I know you can build cached templates using things like smarty (http://smarty.php.net)

Share this post


Link to post
Share on other sites
thanks, you've been of great help

I just have one more question, a bit of an odd scenario.

Say file A includes another file B
Then file A spaws some object from a class file B provided
Then file A alters file B (actually edits it on the HD)
Then file A includes file B yet again... is this allowed, or will it cause some error?

Share this post


Link to post
Share on other sites
hmmm, I have no idea.

I dont see why it wouldn't be permitted, providing the editting that takes place doesn't make a change to the way the files are called.... but, thats really a guess.

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.