I'd like to use set_error_handler() to handle all PHP errors in one place, but I'm afraid that this is something I can't use with cheap webspace hosters. Or must I not worry much about that?
views:
31answers:
3
+1
A:
set_error_handler() is part of the core PHP error handling functions, so it should work on any host.
There isn't a way to disable it that I know of, although setting the error_reporting level to 0 would make it so the handler was never called. This is something you have complete control over however.
zombat
2009-12-27 19:47:43
I suppose it could be disabled with the disable_functions (see http://www.php.net/manual/en/ini.core.php#ini.disable-functions ) directive ; but I don't see why it would be disabled...
Pascal MARTIN
2009-12-27 19:52:44
@Pascal - I just commented on Gumbo's answer about that, very interesting directive! I've never seen it used before.
zombat
2009-12-27 19:57:11
I've seen it used for functions such as popen and fsockopen (The hosting company we use at work disables those, and a couple of others, by default)
Pascal MARTIN
2009-12-27 19:58:39
+1
A:
set_error_handler is just a normal function of PHP -- so it should work on any hosting service.
I really don't see any reason that would justify for a hosting service to disable that function -- and I've never seen it disabled.
Pascal MARTIN
2009-12-27 19:48:34
+2
A:
PHP allows to disable functions with the disable_functions directive. But I don’t see any reason for why anyone would not allow set_error_handler.
Gumbo
2009-12-27 19:51:58
Interesting. I've never encountered that before, but then again, I usually build my own servers, so I guess it's something I don't really need.
zombat
2009-12-27 19:56:07