11

how can I do that?

how do share hosts limit the CPU time for a script?

1

2 Answers 2

4

There isn't a native method for doing this in PHP so I would try phpSysInfo as it provides information on CPU, uptime, ethernet, SCSI, IDE, etc. http://phpsysinfo.sourceforge.net/

Sign up to request clarification or add additional context in comments.

Comments

4

Web hosts have several means of limiting PHP (and how much memory a child web server process can consume). Commonly, PHP is limited by the max execution time configured in php.ini (which is also set so that functions like set_time_limit() can't override it. Additionally, hosts use things ulimit to limit the amount of memory / time that any given process can consume.

If not configured to restrict PHP to individual webroots, you can open /proc/self and have access to statistics about your process. Note, you won't be able to do that, or use phpsysinfo if open_basedir is in effect.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.