sneskid Posted April 14, 2006 Share Posted April 14, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/ Share on other sites More sharing options...
jworisek Posted April 14, 2006 Share Posted April 14, 2006 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 Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26845 Share on other sites More sharing options...
sneskid Posted April 14, 2006 Author Share Posted April 14, 2006 [!--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 windowIf 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. Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26847 Share on other sites More sharing options...
Prank Posted April 14, 2006 Share Posted April 14, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26853 Share on other sites More sharing options...
sneskid Posted April 14, 2006 Author Share Posted April 14, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26855 Share on other sites More sharing options...
Prank Posted April 14, 2006 Share Posted April 14, 2006 yep, precisely.Thats why its important to have well written code. Especially on big sites.C Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26856 Share on other sites More sharing options...
sneskid Posted April 14, 2006 Author Share Posted April 14, 2006 ouchieI 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? Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26857 Share on other sites More sharing options...
Prank Posted April 14, 2006 Share Posted April 14, 2006 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) Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26859 Share on other sites More sharing options...
sneskid Posted April 14, 2006 Author Share Posted April 14, 2006 thanks, you've been of great helpI just have one more question, a bit of an odd scenario.Say file A includes another file BThen file A spaws some object from a class file B providedThen 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? Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26861 Share on other sites More sharing options...
Prank Posted April 14, 2006 Share Posted April 14, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/7376-quick-questions/#findComment-26871 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.