Viewing 6 posts - 1 through 6 (of 6 total)
  • Stopping a PHP script
  • PJay
    Free Member

    I'm in the process of learning a bit of PHP to use on a website I manage. I'm not a complete programming beginner (although it's been a long time since I did anyone and I was never much good) so I'm not finding the basic principles that hard to grasp. However, I am aware that I'm actually running the script server-side on someone elses computer (Dreamweaver allows 'previewing' of the page server-side), in fact on a shared host websever and I'm not going to be flavour of the month if I mess it up. So, how protected is the server from my dodgy programming and can I stop/break a script running on the server if, say, I end up running an infinite loop or do something else dodgy. Should I be 'learning' PHP on a local server (I belive I can run Apache/PHP on my Windows machine).?

    grahamh
    Free Member

    You can run Apache on a windows machine, which will allow you to rest you scripts before uploadng to your web server. If you are running vista then expect a lot of fun and games trying to get the thing to work!
    (I gave up in the end)

    Or you could create a test directory on the web server and run your script from there http://www.sitename.co.uk/test/myscript.php, which is what I do..

    Flaperon
    Full Member

    If you're on a shared server you will find that you will only be able to take up a finite amount of the computer's resources anyway. Don't worry about it. If your script causes problems Apache or IIS will take care of things.

    simonfbarnes
    Free Member

    usually there's a limit of 30 seconds before the process is kicked off

    Surfr
    Free Member

    Write yourself a simple script called phpinfo.php and inside it, just put the folowing:

    <?php phpinfo(); ?>

    And view the page created. Scroll down to the PHP Core configuration section and check the values for max_execution_time and memory_limit if you want to see how your server is configured. It's a useful script to have lying around anyway. If the values are not set, you *may* be able to set them from within your own code by using the ini_set function but this depends on how the server is configured.

    http://uk3.php.net/manual/en/function.ini-set.php

    Don't worry too much though, the system will look after itself unless its run by a complete donkey (who would have had to change a lot of sensible defaults).

    PJay
    Free Member

    Excellent, thank you. I'm currently running in a directory off of our website's root; it's an Apache server. It's good to know that things will be looked after!

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Stopping a PHP script’ is closed to new replies.