Wednesday, April 14. 2004
Ever wonder what it takes to crash PHP, well here is a quick guide . Technically speaking PHP being a high level language should not crash, but reality speaks for itself. By knowing what could make PHP crash it may be possible to implement various safety mechanisms in your PHP configuration that would prevent users from crashing your PHP. This is quite important since a crash is not only a 'bad thing' [tm] in general but can also have several adverse affect on the web server potentially creating a possibility for a local DOS (Denial of Service). So without further ado here is the current crash list:
There are a number of other crashes in PHP, some were fixed and some may still be present. However those tend to be inside obscure extensions that most people do not have enabled and as such are very unlikely. Other crashes while may still exist are in the process of being resolved, unlike the ones listed above that are likely to be around for quite a while.
Top 10 ways to crash PHP
10 ways to crash PHP
Weblog: Taufpate´s a basic life
Tracked: Apr 22, 21:05
Display comments as (Linear | Threaded)
"There are 2 solutions to this problem, 1 avoid using recursive functions they are generally a bad idea anyway..."
If recursive functions were a bad idea, language designers wouldn't go through the significant pain of implementing them in their compilers and interpreters, and in fact virtually all of them do. A good recursive function is often far superior to its iterative counterpart. This is obvious to an ML programmer, for example, but it holds true for PHP as well.
Overall, a nice, comprehensive article, but some editing for grammar would be nice.
It does not take any extra effort to implement recursive functions unless you also implement a safe stack. I can assure you that PHP has no special handling for recursive functions and the engine has no clue that you are in fact using recursive function. Perhaps if it did then this would not be a problem.
P.S. Grammatical corrections are more welcome
Jordan, recursive functions are like the gotos, usefull in some cases, and easy to make ugly things happen.
Ilia, Nice 10 points, i especially like:
shell_exec("killall -11 httpd");
still ROFL here, thx for that
Outstanding article. It provided me with a lot of knowledge in regards to memory allocation.
Nice article, even though it's proof that information is evil.
Excellent, thank you.
"despite it's rare usage" should use "its" because the possessive its has no apostrophe. Only use "it's" when it's short for "it is"
"per say" should be "per se" (apparently it's Latin).
And how about those fairies? http://www.thispot.com/corporate-training-plans.html
on my 3.0ghz, 1024ram, and it crashed after 1 min
Finally figured this out - my http://www.phind.net/finance/debt-relief.html
Zucht. En ik heb al zo'n last van frequent lozen van flatus en RSI. http://www.phind.net/finance/debt-relief.html
Overall, a nice, comprehensive article, but some editing for grammar would be nice
And now the description is wrong. http://e-gold-casino.b0x.com/Top-WebMoney-Games-Catalog.html
it tells me i don't have http://free-download-palm.undonet.com/sgpa.html
This article is now over a year old.
Have these issues been resolved?
All but the unpack() issues are still valid.
These are correct but really not dangerous. PHP scripts have a memory limit of 2MB and execution time limit of 30 sec by deeafult. There is also a stack limit. Additionally, PHP scripts run in their own server thread so they cannot bring down the while server. The above examples will creash the script only for the user crashing it. LOL!
Recursive functions are a bad idea? Are you really out of your mind?
No, I am quite serious. Recursive functions are generally not a particularly bright idea, using a stack is much safer and often faster in any context regardless of the language. In PHP in particular, use of recursive functions is particularly dangerous since lack of stack protection it is possible to crash PHP with it.
Very good report, it helped me to understand why some PHP executable under Win32 did eat up a lot of memory and started to behave weird (100% CPU after a memory increase).
yes i habe to agree amazing report! i will use it in my programming life! thx.
Nice article, even though it's proof that information is evil