admin管理员组

文章数量:1122846

My error when writing a plugin for uploads

and yes, I can debug. But it just jumps directly from this line to destruct

the end of my wp-config.php EDIT:

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

(yes i did restart)

My webcontent folder

So now what?

How do I find out what is the problem?

EDIT it's not file permission as I can do error_log("errrorrrr ", 3 , "..../debug.log")

In my plugin I wrote the line

throw new \Exception("foo");

I want to get to see the error in my debug.log file

My error when writing a plugin for uploads

and yes, I can debug. But it just jumps directly from this line to destruct

the end of my wp-config.php EDIT:

// Enable WP_DEBUG mode
define('WP_DEBUG', true);

// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

(yes i did restart)

My webcontent folder

So now what?

How do I find out what is the problem?

EDIT it's not file permission as I can do error_log("errrorrrr ", 3 , "..../debug.log")

In my plugin I wrote the line

throw new \Exception("foo");

I want to get to see the error in my debug.log file

Share Improve this question edited May 27, 2015 at 16:48 Toskan asked Feb 10, 2015 at 8:23 ToskanToskan 5242 gold badges8 silver badges23 bronze badges 9
  • You have to create the debug.log file in wp-content/ for debug logging to work. – mike23 Commented Feb 10, 2015 at 9:44
  • @mike23 no didn't help, I used as well error_log("errrorrrr "); – Toskan Commented May 25, 2015 at 20:26
  • Side note. Have you checked permissions. Permission to write to debug.log. – Omar Tariq Commented May 25, 2015 at 20:48
  • 1 You said "the end of my wp-config.php"... Is it literally the end? Constants definition goes before the line require_once(ABSPATH . 'wp-settings.php'); or it does nothing... – gmazzap Commented May 26, 2015 at 1:55
  • 1 Make sure you disk-space is not full – Touqeer Shafi Commented May 26, 2015 at 10:04
 |  Show 4 more comments

6 Answers 6

Reset to default 15 +50

Insert this into your wp-config.php

// 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);

Before

/* That's all, stop editing! Happy blogging. */

I had a similar issue when the permissions on the upload dir were not allowing the upload, try that first. Take a look at the codex Changing_File_Permissions for more info.

Alternatively, check that the uploads dir is owned by the same user (on the server) as Wordpress, it's also mentioned in the above link.

For how to... please find someone with more experience ;)

Toskan,

It seems like your wordpress file is not uploaded, so there may be a possibility for one or more issue, Please read out following and apply these solution one by one:

Large images require more memory to process. Are these images particularly large? If yes then try with small image.

Uploaded folder should have write permission, if not then please grant it.

Need to check uploaded directory structure having sub folder created with your current setting OR not, if not then try it manually may be this is again folder permission issue.

If above points is not your solution then please use wordpress plugin 'Debug My Plugin' with Debug Bar(https://wordpress.org/plugins/debug-my-plugin)

It adds a debug menu to the admin bar that shows query, cache and other helpful debugging information.

Also 'Query Monitor'(http://wordpress.org/plugins/query-monitor) is monitoring database queries, hooks, conditionals, HTTP requests, query vars, environment, redirects including automatic AJAX debugging and more.

I hope you find this detail helpful. If you have any query or suggestions to achieve the same result as above plugins does, do share with us.

Thanks!

Another thing to check for is where the WP_CONTENT_DIR points as that is where the debug.log file will be put. This can be set in wp-config.php e.g. define('WP_CONTENT_DIR', '/var/www/sites/wordpress/wp-content');. Normally it shouldn't need to be set unless there's a non-standard setup. The value of WP_CONTENT_DIR may be checked as suggested in this question, or using the Wordfence plugin->Tools->Diagnostics->WordPress Settings.

In my case, I use XAMPP to host WordPress, the log will be in Apache's error.log instead even I have wp-config.php configured.

I also faced this error. What I did was to first create the debug.log file under the wp-content directory. I realized that errors were not logging in this file. Eventually, I decided to change the permission for this file (right-click on the created debug.log file in cPanel, and click on Change Permissions). I changed to 777 (This enables write rule for the file).

I hope it helps!

本文标签: plugin developmentNo Error Log Fileno debug info