I am tring to debug not being able to log in to WordPress desktop. It is loading the plug ins that gives the problem. I can only load 6 plug ins, the error arises trying to load the 7th (regardless of which plug-ins are loaded). I am getting the following error message on debug:
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 2621440 bytes) in /home/networkm/public_html/text/wordpress/wp-admin/includes/file.php on line 1675
The code around this is:
function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
global $wp_filesystem;
$z = new ZipArchive();
$zopen = $z->open( $file, ZIPARCHIVE::CHECKCONS );
if ( true !== $zopen ) {
return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) );
}
$uncompressed_size = 0;
for ( $i = 0; $i < $z->numFiles; $i++ ) {
$info = $z->statIndex( $i );
if ( ! $info ) {
return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
}
if ( str_starts_with( $info['name'], '__MACOSX/' ) ) { // Skip the OS X-created __MACOSX directory.
continue;
}
// Don't extract invalid files:
if ( 0 !== validate_file( $info['name'] ) ) {
continue;
}
$uncompressed_size += $info['size'];
$dirname = dirname( $info['name'] );
if ( str_ends_with( $info['name'], '/' ) ) {
// Directory.
$needed_dirs[] = $to . untrailingslashit( $info['name'] );
} elseif ( '.' !== $dirname ) {
// Path to a file.
$needed_dirs[] = $to . untrailingslashit( $dirname );
}
}
In that code line 1675 is:
if ( true !== $zopen ) { return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) );
I cannot see how/why I’m getting memory size exhausted. There is plenty of room on the disc. Is it a setting in Worpress?