• Hello, I use NextGen Gallery for years, but after the last update if the plugin is enabled I cannot add new post or edit a published post. I recieve a message critical error in website. Tried the troubleshooting, disabled everything and started to enable plugins one by one and found the issue was with latest version of NextGen. If NextGen disabled everything works fine. I’d appreciate any support.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • WP version ? Theme ? Any caching ?

    I have no problem with either Posts or Pages using WP 7.1, Weaver Xtreme, Nextgen 4.4.0, no caching.

    And your PHP version ? I am using 8.3

    Thread Starter nickpapag

    (@nickpapag)

    php 8.4, wordpress 7.1, and w3 total cache

    • This reply was modified 5 days, 9 hours ago by nickpapag.
    Plugin Support Mihai

    (@mceban)

    Hi @nickpapag,

    Thanks for reaching out, and I’m sorry for the trouble you’re experiencing.

    We’re not currently aware of an issue with editing posts, so this might be an edge case that hasn’t been documented yet for our development team.

    To help us figure out what’s causing this, could you enable WP_DEBUG? This will show us the actual error code and the specific line triggering it.

    If you’d like to set up debugging yourself, WPBeginner has a great step-by-step guide you can follow here: How to Enable WordPress Debug Mode.

    Thanks, and please let me know how it goes! 🙂

    Thread Starter nickpapag

    (@nickpapag)

    Thank you so much for the reply! I will do this as soon as possible and let you know Thank you!

    Thread Starter nickpapag

    (@nickpapag)

    Just done a new troubleshooting and found this. Had a fatal error due to this… /wp-content/plugins/nextgen-gallery/src/IGW/ATPManager.php on line 101

    A little searching with AI found that the readfile() is forbidden and changed the code in line 101:

    readfile($template_path);

    with this

    echo file_get_contents($template_path);

    and problem resolved. Any ideas?

    Plugin Support Mihai

    (@mceban)

    Hi @nickpapag ,

    Thanks you for your reply.

    That line reads a small template file from the plugin folder and prints it into the editor page. It only runs on the “Add New Post” and “Edit Post” screens, which is why the rest of your admin area works fine.

    The function it uses to print that file is called readfile(). Your finding points to that function being blocked on your server. When PHP is told a function is off limits, it stops the page right there, and WordPress shows the critical error message. Your replacement uses a different function that your server still allows, so the page loads again.

    Two things would make this certain:

    1. The full error line from your debug log, not just the file and line number. It usually starts with "PHP Fatal error: Uncaught Error:" and names the function. That sentence tells us exactly what your server refused.
    2. Ask your host whether readfile is listed in the “disable_functions” setting of your PHP configuration. Many managed and institutional hosts add it for security reasons, and PHP upgrades sometimes bring a new configuration along with them. That would explain why this started around the same time as the update.

    Your change is a valid fix, but please keep in mind that it lives inside the plugin folder. The next NextGEN Gallery update will overwrite that file and the error will come back. So treat it as a temporary patch, not a permanent one.

    There is a second reason to have readfile turned back on if your host agrees to it. NextGEN uses the same function elsewhere, including when it serves resized images through its dynamic image URLs. With it blocked, those images can fail to load even though the editor problem is patched. If you have noticed any missing or broken thumbnails, that is likely related.

    I am passing this to our development team so the plugin stops depending on readfile for this template. There is a safer way to print that file, and it will remove the problem for any site with the same server restriction. I cannot give you a release date, but I will update this thread once it is in a build.

    In the meantime, please send over that full error line and your host’s answer about disable_functions. I will keep an eye out for your reply.

    Best,
    Mihai

    Thread Starter nickpapag

    (@nickpapag)

    Oh thank you for the reply! This is the full error: Fatal error: Uncaught Error: Call to undefined function Imagely\NGG\IGW\readfile() in /var/www/……../wp-content/plugins/nextgen-gallery/src/IGW/ATPManager.php:101 Stack trace: #0 /var/www/……./wp-includes/class-wp-hook.php(353): Imagely\NGG\IGW\ATPManager->print_tinymce_placeholder_template() #1 /var/www/…../wp-includes/class-wp-hook.php(377): WP_Hook->apply_filters() #2 /var/www/…../wp-includes/plugin.php(523): WP_Hook->do_action() #3 /var/www/…../wp-admin/admin-header.php(151): do_action() #4 /var/www/…./wp-admin/edit-form-advanced.php(418): require_once(‘…’) #5 /var/www/…../wp-admin/post-new.php(75): require(‘…’) #6 {main} thrown in /var/www/…../wp-content/plugins/nextgen-gallery/src/IGW/ATPManager.php on line 101

    Plugin Support Mihai

    (@mceban)

    Hi @nickpapag,

    That is exactly what I needed. Thank you.

    The error confirms it as the important part is this: “Call to undefined function … readfile()”. PHP it is saying the readfile() function does not exist on your server at all.

    That happens when a host turns a function off in the PHP configuration, using a setting called “disable_functions”. From PHP 8 onward, a function turned off that way is removed completely, so any plugin or theme that calls it stops the page with the exact error you sent.

    What to ask your host

    Please ask them to remove readfile from “disable_functions” for your site.

    It is worth saying clearly to them that readfile is a standard, ordinary PHP function for reading a file and sending it to the browser. It is not one of the risky ones that hosts usually block, such as exec or shell_exec. Blocking it breaks plugins across the WordPress ecosystem, not only ours.

    If they will not change it

    Your edit keeps the post editor working, so you are not stuck. Two things to keep in mind.

    First, the file will be replaced on the next NextGEN Gallery update and the error will return. You would need to reapply it each time, until our fix ships.

    Second, the post editor is not the only place NextGEN uses readfile. It also uses it when serving resized images through its dynamic image URLs. So with the function blocked, some images may fail to load even though the editor itself is patched. If you see missing or broken thumbnails anywhere on the site, that is the same cause.

    That is why getting readfile switched back on is the better outcome for you, rather than patching one line.

    I have written this up for our development team with your error and stack trace included. The template on that line is plain HTML, so there is a safe way to print it that does not need readfile at all. Once that change ships, sites with this restriction will not hit the problem.

    I cannot give you a release date, but I will post here when it is in a build so you can drop your patch.

    Thanks again for the careful digging. It made this a quick diagnosis.

    Best,
    Mihai

    Thread Starter nickpapag

    (@nickpapag)

    Thank you so much for the quick replies and support. I’ll do what’s possible to make the plugin running while waiting for your update with the fix. Thanks again!

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.