HEX
Server: nginx
System: Linux pool64-304-45.dca.atomicsites.net 5.10.0-31-amd64 #1 SMP Debian 5.10.221-1 (2024-07-14) x86_64
User: (0)
PHP: 8.4.18
Disabled: pcntl_fork
Upload Files
File: /wordpress/mu-plugins/atomic-cli-wpcom-php-errors.php
<?php

/**
 * Output contents of php-errors
 *
 * [--limit=<number>]
 * : Limit the number of lines returned
 * ---
 * default: 100
 * ---
 *
 * @when before_wp_load
 */
function atomic_tail_php_errors( $args, $assoc_args ) {
	$limit = (int) $assoc_args['limit'];
	$error_log_file = '/tmp/php-errors';
	if ( file_exists( $error_log_file ) ) {
		system( "/usr/bin/tail -n $limit $error_log_file" );
	} else {
		WP_CLI::warning( "No php-errors found" );
	}
};

if ( class_exists( 'WP_CLI' ) ) {
	WP_CLI::add_command( 'php-errors', 'atomic_tail_php_errors' );
}