Debug logs at wordpress not working - wordpress

I would like to enable debug logs of wordpress site, added following setting at wp-config.php
/* WordPress debug mode for developers. */
define('WP_DEBUG', true);
if (WP_DEBUG) {
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
#ini_set('display_errors', 0);
}
created debug.log file under wp-content folder.
updated 777 on wp-content as well as debug.log..
But still file is blank..
Please let me know how can I fix it...
Just I would like to debug the site, some times home page going in infinite loop..i.e. browser not loading the page.. CPU goes to 100%...
Thanks

You have #ini_set('display_errors', 0); - which will tell PHP (not WordPress) to stop displaying errors. WordPress requires errors to be turned on in order for it to pass them to the appropriate place. define('WP_DEBUG_DISPLAY', false); or define('WP_DEBUG', false); should take care of hiding them on the front end for you.
Also, you should only need to define the constants, the IF statement you've created isn't necessary. What you're essentially saying there is "Turn on error reporting. Now, if error reporting is turned on, do this." - although logically correct, it's verbose. Simply defining the WP_DEBUG constant as true should be enough, as WordPress will do the rest of the work.
Also - if wp_debug.log doesn't exist- WordPress will create it for you (with the correct permissions), assuming it has permission to do so on your server (in most cases this will be true). So - you shouldn't need to change the CHMOD values of wp-content or it's children. I'd advise you to change them to WordPress' recommended values (755 for folders, and 644 for files) - as a CHMOD value of 777 is pretty foolhardy to have.
You should only need the following:
define('WP_DEBUG', true); // Turn on WP Debugging
define('WP_DEBUG_LOG', true); // Log errors to wp_debug.log
define('WP_DEBUG_DISPLAY', false); // Turns off error reporting on the front end

According to Debugging in Wordpress:
You must insert this BEFORE /* That's all, stop editing! Happy
blogging. */ in the wp-config.php file
In your case "this" is:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

It may also be worth checking the WP_CONTENT_DIR as that is where the debug.log file would be put. The value of WP_CONTENT_DIR may be checked as suggested in this question, or using the Wordfence plugin->Tools->Diagnostics->WordPress Settings.
Normally it is not explicitly set unless there's a non-standard setup. Though it can can be set in wp-config.php e.g. define('WP_CONTENT_DIR', '/var/www/sites/wordpress/wp-content');

Related

Error log not showing up in my WordPress installation

I get this error message when I try to put a comment on my site: The site is experiencing technical difficulties.
The error message shows up when a user tries to add a comment at my site www.ibdpage or when they try to register.
To track this down I have tried to look at the log file, but I can't get the log file to get written.
I put the lines in wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/public_html/ibdpage/wp-content/debug.log' );
define( 'WP_DEBUG_DISPLAY', false );
Also, the ibdpage.com site is a subdomain of my site napervillegi.com. It is one level deep in the file hierarchy. I have tried both using true or the path to the debug.log file as the argument to define('WP_DEBUG_LOG',...) and it failed both ways.
Meantime, what do I need to do to find out why the error log is not being generated?
define( 'WP_DEBUG', false );
Its already in wp.config.php file
You just need to change it like
define( 'WP_DEBUG', true );
If still you are not able to see the error while adding comments
then add this below line in theme at the top of functions.php file at
ini_set('display_errors', 1);
Hope it will work
Thanks
Start with the simpler:
define( 'WP_DEBUG_LOG', true );
If that is still giving you the "site is experiencing technical difficulties" error, temporarily rename your .htaccess file to ensure there are no strange rewrites causing an issue. This should at least get the logs being written to /wp-content/debug.log inside of this WordPress install.
Regarding the full path however:
define( 'WP_DEBUG_LOG', '/public_html/ibdpage/wp-content/debug.log' );
When accessing the filesystem, even though /public_html/ might be the highest you can go in the file structure of your cPanel account, often you need the full path, which would be something like this:
define( 'WP_DEBUG_LOG', '/home/accountname/public_html/ibdpage/wp-content/debug.log' );
Look for Home Directory in your cPanel or File Manager to discover the correct path.

Once I active Jetpack, I cannot open any dashboard pages any more

I have an issue when I try to install Jetpack on my wordpress site.
When the installation finished, I clicked "active" to active the Jetpack plugin, but I could not open any dashboard pages anymore.
I have already removed all other plugins and reinstalled Jetpack many times, but I still have the same issue.
What did I do is:
Add the following code in wp-config.php file to enable debugging.
// Enable WP_DEBUG mode
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings
define('WP_DEBUG_DISPLAY', false);
#ini_set('display_errors',0);
// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define('SCRIPT_DEBUG', true);
Open [your domain]/wp-content/debug.log to open the log
What did I find is:
PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 30720 bytes) in /hsphere/local/home/.../wp-admin/includes/media.php on line 2765
To slove this problem, i have added the following code in wp-config.php file
define('WP_MEMORY_LIMIT', '64M');
I don't really know the reason, but it works for me.

Wordpress: Cannot login in after upgrade - redirects to blank page

I updated a clients Wordpress to 3.5.2 and now cannot login via wp-admin.
The login form appears but once I hit the Log In button I am just redirect to a blank page with a single . on it. Same happens if I enter the wrong password.
I have checked out the Login Trouble Codex and tried replacing the wp-login.php file and disabling all plugins to no affect. I get the same issue occuring.
Front of the site seems fine.
What appreas in debug:
Warning: Cannot modify header information - headers already sent by (output started at /home/stretton/public_html/fo/wp-content/themes/freya/lib/widgets/banners-125.php:13) in /home/stretton/public_html/fo/wp-login.php on line 369
Warning: Cannot modify header information - headers already sent by (output started at /home/stretton/public_html/fo/wp-content/themes/freya/lib/widgets/banners-125.php:13) in /home/stretton/public_html/fo/wp-login.php on line 381
EDIT: I have also tried:
Renaming my theme to defualt it to the twentytwelve theme
Renaming the plugins directory
Removing the widgets directory
Replacing WP-Admin with from a fresh download
No luck with these either
Rename the active theme and force a revert to twentytwelve. Theme issues can still sometimes cause admin errors. But once the theme reverts, you should be able to get into admin, even if the front end is white-screened.
To figure out what's causing the white screen on the front end (or, if needed, the backend, too) use Debug. See https://codex.wordpress.org/WP_DEBUG
Add to wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
and the debug.log file will be in wp-content. And/or, add this line
define( 'WP_DEBUG_DISPLAY', true);
to dump them to the browser, too.

WP Super Cache caching broken

I am having an ambiguous error. The path in the error is correct:
Warning! WP Super Cache caching broken! The script advanced-cache.php
could not load wp-cache-phase1.php.
Please edit /wp-content/advanced-cache.php
and make sure the path to
/wp-content/plugins/wp-super-cache/wp-cache-phase1.php
is correct.
What needs to be fixed?
The problem is that the constant is not defined until after the plugin loads. This error is possible if the line "require_once(ABSPATH . 'wp-settings.php');" is present in wp-config.php . WPCACHEHOME is probably being defined after this line, but needs to be defined above it:
define( 'WPCACHEHOME', '<site root>/wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager
require_once(ABSPATH . 'wp-settings.php');
http://wangweiqiang.net/warning-wp-super-cache-caching-broken-the-script-advanced-cache-php-could-not-load-wp-cache-phase1-php/
This worked like a charm for me...!
This is a permission issue, U should check that the paths mantioned in the error notice have 777 permisions, BUT, my advice on this issue is simply to NOT use this plugin, I had it installed on some of my site, and almost in all of them it caused errors on diffrent elements on my site.
I'm not saying that using this plugin will cause problems for sure, but this plugin is known as problematic, and for my opinion it doesn't justify itself.
Please use this in your wp-config.php file
define('WPCACHEHOME', dirname(__FILE__) . '/wp-content/plugins/wp-super-cache/');
before
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');

moving Drupal 6 site - get blank white page

I moved Drupal from one Linux server to another by copying files to PC then back to new server. I made changes to settings.php to reflect new database name. I got PHPmyADMIN working, so I know database and server are running.
When I run index.php, I get white screen. However in index.php when I echo out menu_execute_active_handler(), I get some part of my home page without menus. I think that this means that I am getting through bootstrap but failing somewhere else. Any ideas?
index.php
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$return = menu_execute_active_handler();
echo $return ;
Turn display_errors on in your php.ini file.
Your new server probably has them disabled.
Put this code in your index.php to see the error
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

Resources