Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts

    Is PHP code always executed on the server end?

    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:

    PHP Code:
    $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?
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.....

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #4
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    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?
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #5
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #6
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #7
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    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

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by firepages
    total world domination should occur at approximately 3:25 EST 15 August 2004.
    Shouldn't that be unixtimestamp?

    approximately 1092558300
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •