Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+01:00)
All URLS in this thread are only visible to me and you.
As for error logs, I only see:
[21-Oct-2024 07:38:33 UTC] PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in /home/ipkkcji/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php on line 50
[21-Oct-2024 07:38:33 UTC] PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line
But no call stack.
Can you try with this?
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
// Disable the display of errors and warnings on the frontend
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
// Ensure errors are logged
@ini_set( 'log_errors', 1 );
// Set a custom error log file
@ini_set( 'error_log', dirname(__FILE__) . 'https://cdn.wpml.org/wp-content/wp-errors.log' );
// Capture a detailed backtrace when a memory limit error occurs
function memory_exhaustion_handler() {
$error = error_get_last();
if ( $error && strpos( $error['message'], 'Allowed memory size' ) !== false ) {
error_log( "Memory exhausted: " . print_r( $error, true ) );
// Add a backtrace to the log to see what caused the error
error_log( "Stack trace:" );
error_log( print_r(debug_backtrace(), true) );
}
}
register_shutdown_function('memory_exhaustion_handler');
These settings enable WordPress's debug mode and log the errors into a file (wp-content/debug.log). However, we're using a custom file for more control (wp-content/wp-errors.log).
The memory exhaustion-related errors, including the stack trace, will be logged in the file wp-content/wp-errors.log.
The backtrace will show you exactly what functions were called and which files and lines led to the memory being exhausted.
So:
- Add this to the wp-config.php file on the client’s server.
- Monitor the wp-errors.log file within the wp-content folder.
- Reproduce the error to capture the full stack trace.
The topic ‘[Closed] fatal error’ is closed to new replies.