Where should I tell WordPress where error_log messages should be written?

On WP side the only handling it does is setting log to WP_CONTENT_DIR . ‘/debug.log’ if WP_DEBUG_LOG is enabled (highly bad idea in production environment as public location). If I remember right the very early implementations of this constant allowed to customize the path, but that’s no longer the case. In my experience ini_set( ‘log_errors’, … Read more

How can I determine what php files are being called by a given WP page?

There’s a native PHP function get_included_files() for that. Simply attach it to an action on the hook from where you want to know it. The first one is muplugins_loaded and the last accessible on is shutdown. add_action( ‘muplugins_loaded’, function() { $files = get_included_files(); foreach ( $files as $f ) echo $f.'<br>’; // or… var_dump( $files … Read more

Nginx – Prevent Access to Debug file [closed]

I’ve frequently seen this used in Apache 2.2: <Files “debug.log”> Order allow,deny Deny from all </Files> but that’s deprecated in Apache 2.4: The Allow, Deny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use. I just … Read more