Plugin Author
Tim W
(@timwhitlock)
Your error says the built-in PHP error_log function is not defined. I don’t know how that’s possible. What version of PHP are you running? Do you have some kind of custom PHP runtime?
As a side note: your error shows the file name as exception.php, but it is Exception.php with capital “E”. Any idea why that would be?
Plugin Author
Tim W
(@timwhitlock)
Also, are you able to post the stack trace that follows this error?
The website has the latest WP version installed and it doesn’t have any custom PHP runtimes as far as I know. Apologies, the Exception thing is a typo from my side, would this screenshot of the stack trace be of any help?
Stack trace
About the built-in PHP error_log function, there was a plugin called Error Log Monitor installed on the website, is it possible that this function was overwritten/deleted somehow?
Plugin Author
Tim W
(@timwhitlock)
it doesn’t have any custom PHP runtimes as far as I know
You don’t know that it’s custom. Fair enough. But do you know that it’s not? Are you able to verify that the error_log function is available in the runtime that WordPress operates under?
would this screenshot of the stack trace be of any help?
Thanks, the trace shows normal operation of the plugin. This eliminates one of my lines of enquiry, so that’s good. Except it doesn’t solve anything.
there was a plugin called Error Log Monitor installed on the website, is it possible that this function was overwritten/deleted somehow?
I don’t see how it could. PHP functions can’t be redefined. I’ve been writing PHP for 20 years, but I’m always happy to learn something new. Currently I have no line of enquiry except that I found one other topic in the WordPress forum that shows the same weird occurrence.
Frankly there’s not much I can do here. My plugin code has to assume that built-in PHP functions exist. If a function is absent in certain versions of PHP then I will work around that, but that doesn’t seem to apply here.
I accessed the server and the PHP Interpreter version was set to 8.1. Switching back to the default 7.4 version fixed the problem. Your input was really helpful, appreciate it thank you!
Plugin Author
Tim W
(@timwhitlock)
I’m glad you fixed your problem, but I’m keen to understand what it was. As people upgrade to PHP 8.1 I want to be ready to solve this for the next person. Can your hosting provider explain why error_log is undefined in their PHP 8.1 runtime?
The hosting provider is “KeyWeb” and the server management tool is “KeyHelp Pro”, not sure if that info alone can help you. I’ll speak with my client as well and see if we can get some explanation about this from them.
We didn’t get any detailed explanation about the undefined error_log function, all the hosting company said was “We have now activated it.”.
Out of curiosity I tried setting the PHP version to 8.1 again to see if the critical error would be gone, but I couldn’t and still can’t access the domain at all, getting
"503 Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later."
We didn’t enquire further as it didn’t seem worth doing so and just left the version set at 7.4.
Plugin Author
Tim W
(@timwhitlock)
Thanks for letting me know. I’ll be sure to avoid KeyWeb, as I’ve never heard of such a thing.
You might want to consider upgrading to PHP 8.0 at some point to see if you have any problems. PHP 8.1 is a much bigger jump in terms of code compatibility. However, PHP 7.4 will be pretty safe for a good while.