Re: How to control the php stand-alone process
Hello Rudi Starcevic <firstname.lastname@example.org>,
You mean ulimit? Well, ulimit is a bash command to control system wide
resurce restrictions. Usually recommended to modify with "sysctl"
command or define in /etc/security/limits.conf.
My idea is, if the uid running php scripts does not reach its resource
limit(ram,cpu time,etc.) All the hell is it is using the process for too
long and can't exit itself. If I use ulimit or OS-wide restriction, I
can only set the max number of processes. In this case, when php scripts
increases to the max number of processes of that uid, some other normal
php cron scripts may fail to initialize due to the max process
I hope there will be some restriction to limit individual php process,
not the total amount of processes or CPU time that a uid can use.
Thanks for your information anyway. :-)
On Tue, 16 Apr 2002 11:15:58 +1000
Rudi Starcevic <email@example.com> wrote:
> Hi Patrick,
> Sorry I don't have the exact answer your after.
> I did find a document that might help though.
> Check out
> I think the 'ulinit' command may help.
> Let me know how you go.
> Patrick Hsieh wrote:
> >Hello "Rudi" <firstname.lastname@example.org>,
> >Thanks. My question is, since there are many stand-alone php scripts
> >frequently activated and, hopefully, gracefully exit in my system, I,
> >as the superuser, have to allocate reasonable resource for them to avoid
> >unpredictable situation to cause resource exhaust. Well, I can use
> >sysctl command to give reasonable resource of the user running php
> >stand-alone scripts, however, if there are some problems which result
> >into some php processes staying in the system for too long. I have to
> >avoid that situation, because this could cause a lot of php processes
> >hanging in my system, some of them should have been running for weeks.
> >I know top or ps can get the status of them and I can of course make any
> >changes of them. However, I just want to know a hard limit control to
> >the stand-alone scripts. Even when php scripts use system call and
> >therefor can't be restricted by its native timeout function, I still
> >can make a system-wide restriction and timeout control of them.
> >On Mon, 15 Apr 2002 21:30:28 +1000
> >"Rudi" <email@example.com> wrote:
> >>Hello Patrick,
> >>I've used standalone php scripts to fetch data for
> >>from the web.
> >>Isn't using PHP as a scripting language cool ?
> >>I found the script execution setting in the php.ini file
> >>does the trick.
> >>With regards to CPU usage I would try Top again.
> >>When top is running press 'h' to see other commands
> >>available to you.
> >>Select 'shift a' to sort by age or 'u' or sort by user.
> >>Hope this helps
> >>----- Original Message -----
> >>From: "Patrick Hsieh" <firstname.lastname@example.org>
> >>To: <email@example.com>
> >>Sent: Monday, April 15, 2002 7:54 PM
> >>Subject: How to control the php stand-alone process
> >>>Hello list,
> >>>I have some stand-alone php scripts in the cron job. I want to limit the
> >>>max execution time for single php process. In the php document:
> >>>Note: The set_time_limit() function and the configuration directive
> >>>max_execution_time only affect the execution time of the script itself.
> >>>Any time spent on activity that happens outside the execution of the
> >>>script such as system calls using system(), the sleep() function,
> >>>database queries, etc. is not included when determining the maximum
> >>>time that the script has been running.
> >>>Since the set_time_limit() and max_execution_time can't handle system
> >>>call used in the php scripts, how can I get the max time control for
> >>>each php script? If I can't, chances are some php scripts may keep in
> >>>the process for couple days, which is unwise.
> >>>Patrick Hsieh <firstname.lastname@example.org>
> >>>GPG public key http://pahud.net/pubkeys/pahudatpahud.gpg
> >>>To UNSUBSCRIBE, email to email@example.com
> >>>with a subject of "unsubscribe". Trouble? Contact
Patrick Hsieh <firstname.lastname@example.org>
GPG public key http://pahud.net/pubkeys/pahudatpahud.gpg
To UNSUBSCRIBE, email to email@example.com
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org