How do I configure php.ini so that PHP scripts that go into an infinite loop won't consume up all the system resources? I want to make it so that each script isn't allowed more than 10 MB of memory or something like that.
there should be a setting in your PHP Configuration but if its not your server then hopefully that willwork.
The good stuff is more towards the end
One thing to note is that both the ABORTED and the TIMEOUT states can be active at the same time. This is possible if you tell PHP to ignore user aborts. PHP will still note the fact that a user may have broken the connection, but the script will keep running. If it then hits the time limit it will be aborted and your shutdown function, if any, will be called. At this point you will find that connection_timeout() and connection_aborted() return true. You can also check both states in a single call by using the connection_status(). This function returns a bitfield of the active states. So, if both states are active it would return 3, for example.
void set_time_limit (int seconds)
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the configuration file. If seconds is set to zero, no time limit is imposed.
When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.
Note that set_time_limit() has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the configuration file.
int ignore_user_abort ([int setting])
This function sets whether a client disconnect should cause a script to be aborted. It will return the previous setting and can be called without an argument to not change the current setting and only return the current setting.
encase the numbers in brackets (30); because it is a function
I wouldnt be able to take a quess at how you lmit the Memory loss. It really cant be done. thats up to the configuration of the Server. Technically the Memory should be recovered when the script is finished executing be if completting or tetermination