I run multiple WordPress sites which have multiple themes and plugins from multiple different authors. I always check my error log and try to contact the authors to fix bugs in their code, but a lot of them are logged as something like:
PHP Deprecated: wpmu_new_blog is <strong>deprecated</strong> since version 5.1.0! Use wp_insert_site instead. in /wp-includes/functions.php on line 5148
PHP Warning: array_merge(): Argument #3 is not an array in /wp-includes/class-wp-customize-widgets.php on line 376
PHP Warning: Error while sending QUERY packet. PID=23688 in /wp-includes/wp-db.php on line 2033
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /wp-includes/wp-db.php on line 1635
As you can see, the warnings occurred in files inside wp-include, which are available to all plugin/theme/core authors, so there is no way for me to find out who called the deprecated function, passed the wrong function parameters or whatever they did.
I also cannot easily reproduce the error in a dev environment because I don't know what action triggered it.
Everything would be much easier if I could change some PHP (or even server) setting that would cause a stack trace to be appended to each error log message.
This is one of those things that, as common as my problem probably is, Google is unhelpful because all search results try to explain how to append the stack trace to my own code, not to anyone's code.
You could install the Xdebug extension to PHP, which overrides the error logging mechanism of PHP and adds stack traces to errors, warnings, etc. when enabled. See Xdebug documentation.
Related
After an automatic update to my WordPress installation, my website is display this error rather than loading.
Deprecated: File wp-db.php is deprecated since version 6.1.0! Use wp-includes/class-wpdb.php instead. in /home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/functions.php on line 5595
Warning: require(/home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/class-wp-dependencies.php): failed to open stream: No such file or directory in /home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/script-loader.php on line 23
Fatal error: require(): Failed opening required '/home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/class-wp-dependencies.php' (include_path='.:/usr/share/pear/') in /home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/script-loader.php on line 23
Notice: Function is_embed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/functions.php on line 5835
Notice: Function is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/vol13_4/epizy.com/epiz_30367402/htdocs/wp-includes/functions.php on line 5835
There has been a critical error on this website.
Can someone help me understand this error, and provide me a solution or some hints so that I can figure a fix for this.
I also had the same problem currently. So here's how I fixed it.
Go to your Website's App Installer > Wordpress > and find something like this
https://i.stack.imgur.com/xvhm0.png
Click the one in the blue box i drew at the right (Wordpress Manager)
Then, there you can update wordpress
Hope it helped!
i solved it just by updating all plugins, idk why it worked but you can give it a try.
I cannot seem to locate the source of this issue. I actually have nearly the same Docker container and Exception handler lib running in another app. However, for some reason, I'm getting duplicate log entries in the error log file.
The issue is that it's not just duplicate entries that are the same (that'd be another interesting issue). It's the same Exception being logged and the same stack trace, but one is from my custom Exception handler (JSON), and the other is the default PHP error log handler (or so it seems - tested with CLI SAPI as well as PHP-FPM).
I was under the assumption that PHP wouldn't write to the log file if an exception handler was set. I'm also executing die(1) at the end of the callback function for the Exception handler.
Again, all of the Exception handling code seems to be working well. It's just that PHP is still logging the Exception. Is there a setting or something else that I'm missing here needing to be done on the PHP config side?
Below is a copy of the error log output:
[24-Nov-2018 02:20:11 UTC] PHP Exception: Testing in /srv/www/boot/common.php on line 65
[24-Nov-2018 02:20:11 UTC] PHP Stack trace:
[24-Nov-2018 02:20:11 UTC] PHP 1. {main}() /srv/www/public/index.php:0
[24-Nov-2018 02:20:11 UTC] PHP 2. require() /srv/www/public/index.php:13
{"timestamp":"2018-11-24 02:20:11 UTC","level":"critical","message":"Testing","app_version":{},"environment":"dev","class":"Exception","file":"\/srv\/www\/boot\/common.php","line":65,"code":0,"previous":null,"trace":[{"file":"\/srv\/www\/public\/index.php","line":13,"function":"require"}],"user":[],"tags":[],"extra":[],"output_buffers":[]}
Going to leave this here for anyone that might come across this. The issue turned out to be XDebug which hijacks your Exceptions. It was enabled on this particular app in our dev env.
So I'm trying to figure out a website error for my friend. Unfortunately, I'm not that good at PHP and unfortunately his website is...ancient. I tried referring to other questions here, but as my code example looks a tad different, I'm worried about messing something up.
Right now, the site is permanently down with the following error:
Fatal error: Uncaught Error: Call to undefined function
set_magic_quotes_runtime() in
/customers/1/f/7/WEBSITEDOMAIN.COM/httpd.www/includes/framework.php:21 Stack
trace: #0 /customers/1/f/7/WEBSITEDOMAIN.COM/httpd.www/index.php(22):
require_once() #1 {main} thrown in
/customers/1/f/7/WEBSITEDOMAIN.COM/httpd.www/includes/framework.php on line 21
So, I referred to the website files, oddly enough, there are four framework.php files but I assume some of them might be irrelevant. All of them contain the following code somewhere around line 21:
#set_magic_quotes_runtime( 0 );
#ini_set('zend.ze1_compatibility_mode', '0');
So, my idea is, remove it all, or just the first line as the error message refers to. This is what the other questions on SO hinted at, as the first line is completely irrelevant with the newest php version. However, as this is a business website I'm also hesitant to mess around, even more so as the owner understands nothing about code.
Any pointers for a complete newbie? (Websitedomain.com is an example address)
Thanks
I am working with IIS. I just upgraded php from 5.2 to 7.0. Unfortunately, I'm getting the WSOD. However, the WSOD happens inside my dashboard area and not on the home page (I'm on a multisite installation, by the way).
I added the necessary lines in my php.ini file to get the errors to show and this is what came up on the white screen:
"Uncaught Error: Call to undefined function mysql_connect() in E:\inetpub\fcpsblogs\wp\wordpress\wp-includes\wp-db.php:1564
Stack trace:
`#0 E:\inetpub\fcpsblogs\wp\wordpress\wp-includes\wp-db.php(592): wpdb->db_connect()
`#1 E:\inetpub\fcpsblogs\wp\wordpress\wp-includes\load.php(404): wpdb->__construct('[username]', '[password]', 'wp', 'localhost:3307')
`#2 E:\inetpub\fcpsblogs\wp\wordpress\wp-settings.php(106): require_wp_db()
`#3 E:\inetpub\fcpsblogs\wp\wordpress\wp-config.php(124): require_once('E:\inetpub\fcps...')
`#4 E:\inetpub\fcpsblogs\wp\wordpress\wp-load.php(37): require_once('E:\inetpub\fcps...')
`#5 E:\inetpub\fcpsblogs\wp\wordpress\wp-admin\admin.php(31): require_once('E:\inetpub\fcps...')
`#6 E:\inetpub\fcpsblogs\wp\wordpress\wp-admin\index.php(10): require_once('E:\inetpub\fcps...')
`#7 {main} thrown in E:\inetpub\fcpsblogs\wp\wordpress\wp-includes\wp-db.php on line 1564"
(all minus the tick marks at the beginning of each line. I added those so that the pound symbol can show)
So I researched the error and it said that WP was thorwing this because I was using php_mysql as opposed to php_mysqli. I searched high and low and I cannot find where php_mysql is. I believe it's disabled everywhere. There's not even a reference to it in my php.ini file. Can anyone tell me where else I can check so that I can get past this issue?
I have an issue with mysql_connect(). I have done complex research, but found only some general articles about PHP error control operator or custom error handling in PHP and similar ones. My issue is like below:
I have this code and supposing to suppress mysql_connect()'s warning when the connection fails. When I was writing it, my thoughts were like this:
"Turn off errors, then connect to mysql server and if connection fails, suppress warning, then select the database and if selecting fails, suppress warning, and finally turn on errors."
But when I kill the MySQL service process, from PHP I get this warning:
Warning: mysql_connect(): in C:\fakepath\connect.php on line 29
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in C:\fakepath\connect.php on line 31
And that's not what the script I have supposed to do. Could you someone please explain me why does PHP do this?
I am aware that PHP's mysql extension is not recommended; but what I am working on is an older project and I know what I do.
Posted on behalf of OP:
Finally I have found an answer for this.
I had set error_reporting hardly via php_admin_value in my Apache's httpd.conf and according to that, any lower-level configuration (and also script itself) had been unable to override that setting.
I just commented out the directive and everything works as expected.