• Resolved HarroH

    (@harroh)


    Hi All,

    I moved a website from my local development server to the real server and when I go to the admin I get the following error:

    Fatal error: Call to undefined function nocache_headers() in /websites/nemesys.nl/develop-www/wp-admin/admin.php on line 32

    However, when I check functions.php in de wp_include folder the file and the function are there.

    I have the feeling it is a badly configured server but I don’t know where to look. Anyone any suggestions. Here is the PHP info:
    https://develop-www.nemesys.nl/info.php

    Thanks in advance.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Well, there may be some problem with your file and folder permissions and the owner, check whether your websites files have 664 permissions and folders have 755 permissions.

    Thread Starter HarroH

    (@harroh)

    Hi udaraaka,

    Thanks for the suggestions, but folder permissions were not the problem. Set all files to 664 and folders to 755 to be sure, but no effect.

    Any other suggestions anyone?

    Well, you said you changed ur website from your local development server to the real server. Did you change the home and siteurl of the wp_options table in your database properly?

    Set all files to 664 and folders to 755 to be sure

    Try 644 for files.

    oh, sorry yeah, not 664 it’s 644, anyway 644 is more restrict than 664 so I think it doesn’t have any effect

    Thread Starter HarroH

    (@harroh)

    weirdest thing is that I can go to the login page and the homepage (they load oke) but when it loads the admin, it gives this error. I have the feeling there is something wrong with the include because wp_admin is in a subfolder, but cannot find anything yet that explains why.

    Thread Starter HarroH

    (@harroh)

    Hi udaraaka, Yes, have already changed the paths.

    if you think it’s a problem with includes, try to change
    require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
    around line 30 to
    require_once('../wp-load.php');
    Which will directly include the wp-load.php which makes all default wordpress functions available to current script.

    Thread Starter HarroH

    (@harroh)

    I’m getting crazy I think, just don’t get it.

    No difference in changing
    require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
    to
    require_once('../wp-load.php');

    However, it must be included, because changing it in:
    require_once(dirname(dirname(__FILE__)) . '/wp-load.php.TEST');
    gives an error that it cannot include, logic.

    But when I do this in wp-load.php

    <?php
    echo 'TEST';
    ?>

    It doesn’t output TEST at all on the page. Just the same error. So it seems the wp-load.php is somehow being included, but at the same time everything in the file is being ignored :S

    Thread Starter HarroH

    (@harroh)

    OKE, FOUND THE PROBLEM!

    But still need some help.

    I figured out that require_once is not working properly. So I just changed every single require_once for an include instead. And now it works.

    However, this is of course not a solution, thinking about future updates. Could this be a PHP installation problem? Server error?

    The difference between require and and include is that if you require() a file that can’t be found then it generates a fatal error which will halt the execution of the page completely (which happned with your first case), and no more output will be generated. On the other hand, if you include() a file that can’t be loaded, then this will merely generate a warning and continue building the page. It is not a PHP problem. definetely file permission problem, or error in your wordpress configuration. YOu can try if this.
    create new php file with and put it on the same folder as wp-load.php then put

    <?php
    require_once('wp-load.php');
    echo get_site_url();
    ?>

    and run that file in your browser and check whether it display your site url properly

    Thread Starter HarroH

    (@harroh)

    Hi udaraaka,

    Thanks for the reply.

    But with your logic, both include and require_once should generate an error, one is fatal, the other one is a warning. But with include I don’t get any warning and the file is included properly, all functions are available. With other words, the file path is oke and the file permissions are also in order as it is being included properly by include(). even setting every file and folder to 777 did not work.

    I also installed the same config on another server and had no errors at all, which to me indicates that there is nothing wrong with my wordpress config unless there are specific hosting configurations needed. Which I have not been able to find what that should be.

    I still believe its a server issue as it is a self hosted environment from the client, not a generic hosting provider. I will have to ask the system admin to check into this as I’m out of idea’s.

    Appreciate your help though!

    Thread Starter HarroH

    (@harroh)

    For those who have the same problem, here the answer; it was a server config error. Here is how to solve it:

    First of all check if you have php-apc installed. if you have it, edit the apc.ini (it should be /etc/php.d/apc.ini on CentOS), and disable the include_once optimization:

    apc.include_once_override=0

    restart your web server!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘nocache_headers error after moving server’ is closed to new replies.