PDA

View Full Version : Are PHP code always executed on the server end?


WA
07-18-2002, 10:25 AM
This may sound like a naive question, and as a PHP beginner, I guess it is. Are all PHP scripts executed on the server end?

I'm looking at while loops now, and a thought occurred. Let's say I have a run-away while loop:


$runaway=3
while ($runaway>0)
$notgood="yes"

The above obviously will execute forever. My question is, in the above, is it the server that gets exhausted, or the client side/browser? I know PHP works on the server side extensively, but are all codes in PHP executed by the server?

Cloudski
07-18-2002, 10:34 AM
I am not fully sure, but from what I can tell, it is still on the server's end when something like that happens. I believe that the code will go on forever, or you will get some type of error... could be run-time or something... Again, I am not sure, as I am pretty much a newb at it.....

firepages
07-18-2002, 12:18 PM
Yes, always at the server end (though there are plans afoot for something completely different !)

however unless overridden (you can alter the timeout on a page basis with PHP) the script will timeout after the default timeout of 30 seconds(or as set in the php.ini) and you should get an error msg something like this...

Fatal error: Maximum execution time of 30 seconds exceeded in /fire/www/...blah blah

but note that some scripts which call external routines (PERL mailers etc), can hang and never terminate till you kill it manually, but in the ain a timeout will occur before you annoy anyone too much.

WA
07-18-2002, 12:48 PM
Thanks firepages. That makes sense- timing out.

Now you've gotten my attention with "Yes, always at the server end (though there are plans afoot for something completely different !)" More info? :)

Jeewhizz
07-18-2002, 02:46 PM
George - using PHP GTK you can create a GUI that runs on the user's PC... something like a browser but is coded in PHP using image libraries. http://gtk.php.net for more details.

Jee

firepages
07-18-2002, 03:00 PM
Jee I was referering to the possibility of clientside PHP scripting i.e.

<script language="phpscript"> echo 'all your VB are belong to us' </script>

there are probably a thousand reasoons that this is not a good idea;), but rumblings surrounding this possibility are growing louder daily - especially with the so-far-so-very good happenings with the Zend2 engine (and the required OO functionality).

With Zend2/PHP5 + GTK2 all on the horizon total world domination should occur at approximately 3:25 EST 15 August 2004 , but thats a rough estimate and it may actually take till the following tuesday.

bcarl314
07-18-2002, 08:05 PM
Originally posted by firepages
Jee I was referering to the possibility of clientside PHP scripting i.e.

<script language="phpscript"> echo 'all your VB are belong to us' </script>

there are probably a thousand reasoons that this is not a good idea;), but rumblings surrounding this possibility are growing louder daily - especially with the so-far-so-very good happenings with the Zend2 engine (and the required OO functionality).

With Zend2/PHP5 + GTK2 all on the horizon total world domination should occur at approximately 3:25 EST 15 August 2004 , but thats a rough estimate and it may actually take till the following tuesday.

Oh that's just great, so now in addition to learning browser specific implementations of JavaScript, we'll have to do it with PHP as well. Ugh, I just hope MS stays away! Shoo Bill shoo

Ökii
07-18-2002, 08:22 PM
Originally posted by firepages
total world domination should occur at approximately 3:25 EST 15 August 2004.

Shouldn't that be unixtimestamp?

approximately 1092558300 :D