• Resolved mrkuvis

    (@mrkuvis)


    Hi!

    I tried to open the page “/wp-admin/options-permalink.php” on my site, but it wouldn’t load because of a critical error. It turns out the problem is as follows (from debug.log) :

    PHP Fatal error: Uncaught Error: Call to undefined function flock() in /www/.../html/wp-admin/includes/misc.php:182
    Stack trace:
    #0 /www/.../html/wp-admin/includes/misc.php(285): insert_with_markers()
    #1 /www/.../html/wp-includes/class-wp-rewrite.php(1899): save_mod_rewrite_rules()
    #2 /www/.../html/wp-includes/rewrite.php(282): WP_Rewrite->flush_rules()
    #3 /www/.../html/wp-admin/options-permalink.php(212): flush_rewrite_rules()
    #4 {main}
    thrown in /www/.../html/wp-admin/includes/misc.php on line 182

    Once I comment out the two lines in misc.php that use the function flock(), the page (options-permalink.php) opens just fine. But I realize this might not be an optimal solution or might even raise other issues!

    So my question is – how come a native PHP function flock() is undefined, and how can I fix this in a better way? On previous lines in misc.php other PHP functions are used, such as fopen(), and there’s no error. I have PHP 8.1 and the latest WP version (6.5.2).

    I don’t know if this is related to updating to the new WP version or not, as I haven’t tried opening the page in question earlier. But today, while debugging, I disabled the Elementor plugin and tried to re-enable it – that wouldn’t happen because the plugin would cause an error, but once I commented out those lines in misc.php I could enable Elementor again. Such a problem hasn’t happened before with plugins, so I’m guessing this might have something to do with the update.

    (Originally navigated to options-permalink.php to flush permalinks because the Site Health suggested that, saying “The authorization header is missing”, which I guess is a whole different issue I have no idea about ?? The site was originally made by someone else and I have gradually learned WP stuff myself to do changes to it.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The function may be blocked in PHP. There is a setting called “disable_functions” in PHP for this. You would need to check whether this is the case for you in the PHP settings in your hosting. Your host’s support team should be able to help.

    And I would advise against customising any WordPress core file. On the one hand, you will no longer be able to get support here, and on the other hand, your changes will be overwritten with every update anyway.

    Thread Starter mrkuvis

    (@mrkuvis)

    Thanks for the quick reply! I’ll email my host support team.

    If the setting can’t be changed for some reason, is there anything I can do to fix it (other than modifying the core file)?

    You could move your website to another host that does not have such a restriction. I’m not aware of anyone who does – so I’m surprised that you have such a problem. For this reason, I am also positive that the actual hoster’s support can help.

    Thread Starter mrkuvis

    (@mrkuvis)

    Okay, let’s see what the support team replies. Thank you for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Call to undefined function flock() in …/html/wp-admin/includes/misc.php:182’ is closed to new replies.