Stopping a PHP scri...
 

MegaSack DRAW - 6pm Christmas Eve - LIVE on our YouTube Channel

[Closed] Stopping a PHP script

5 Posts
5 Users
0 Reactions
72 Views
 PJay
Posts: 4885
Free Member
Topic starter
 

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).?


 
Posted : 22/02/2010 4:53 pm
Posts: 74
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 www.sitename.co.uk/test/myscript.php, which is what I do..


 
Posted : 22/02/2010 6:00 pm
Posts: 7983
Free 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.


 
Posted : 22/02/2010 6:21 pm
Posts: 0
Free Member
 

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


 
Posted : 22/02/2010 6:22 pm
Posts: 0
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).


 
Posted : 22/02/2010 6:37 pm
 PJay
Posts: 4885
Free Member
Topic starter
 

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!


 
Posted : 22/02/2010 7:23 pm