My error when writing a plugin for uploads
and yes, I can debug. But it just jumps directly from this line to
the end of my
// 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
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
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);
/* 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 😉
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.
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
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.