Skip to content

Debugging and logging in PHP

You can also debug the problem as follows:

Put this on your wp-config.php file:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
This will create the file: wp-content/degub.log. In order to see some debug, just add lines like these on the dl-file.php:

error_log("Before doing checks");
error_log("After doing checks");
error_log("auth_user_login: " . $auth_user_login);
error_log("auth_user_role: " . $auth_user_role);
//For a complex variable
error_log("folder_permissions: " . var_export($folder_permissions, 1));
error_log("is_user_allowed" . var_export($is_user_allowed, 1));
error_log("is_role_allowed: " . var_export($is_role_allowed, 1));
Just put them in the code at the proper places. Then you can just check the output of debug.log:
tail -f wp-content/debug.log

Put this on your Apache VirtualHost:
LogLevel alert rewrite:trace3

And then restart Apache and check for the error log:
tail -f /var/log/apache2/error.log | fgrep '[rewrite:'  | grep 'dl\-file'

This will show you if the RewriteRule on your .htaccess is been applied.

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen