Support » Fixing WordPress » Please Help! Call to undefined function get_header() in index.php on line 5

  • Resolved fish911

    (@fish911)


    Hi
    First let me say I’m aware similar errors have been addressed and resolved on this forum but nothing that duplicates my error.
    My url is http://www.jrjbroofing.org

    My site seems to be working properly on the front-end and when using the admin panel but when I check my themes error log files I’m receiving the error listed below about every 3 days.

    Call to undefined function get_header() in /home2/fish/public_html/wp-content/themes/rttheme15/index.php on line 5

    I’ve checked that themes index.php is not located in the root dictionary, that seems to fix this error for most. Unfortunately I’m not one. Also I’ve compared index.php with a fresh copy and it’s seems to be all downloaded correctly and in the right location.

    I’ve looked at my header.php and compared to a fresh copy and it also seems to be all downloaded.

    I really have no clue what’s causing this error like I said other having this error can’t access their site or admin panel.

    Thanks in advance for any and all help.

    https://wordpress.org/plugins/post/

Viewing 15 replies - 1 through 15 (of 19 total)
  • I believe someone or a bot is directly accessing your theme’s index file like this

    http://www.jrjbroofing.org/wp-content/themes/rttheme15/index.php

    You do not have to worry about this. Just ensure PHP errors are hidden from the front end by setting WP_DEBUG to false.

    Thread Starter fish911

    (@fish911)

    Hi Jesin
    Thanks for the response
    I read over the link you gave me on setting WP_DEBUG to false. I’m just not sure how or where to change the settings to false?

    If the default value is false, I’m not sure why it would be set to true. I’ve never changed it that I’m aware of. Could this of happened when I changed themes?

    Just curious.

    Thanks for you time
    Roger

    Thread Starter fish911

    (@fish911)

    Update: I went to wp-config.php and change this:

    <?php
    /** Enable W3 Total Cache */
    define(‘WP_CACHE’, true); //Added by WP-Cache Manager

    to this:
    <?php
    /** Enable W3 Total Cache */
    define(‘WP_CACHE’, false); //Added by WP-Cache Manager

    I then followed the link above you supplied to the direct path and I still receive the same error?
    Am I doing this wrong?

    I’m not even using the w3 total Cache plugin not sure why that’s there?

    Hi Roger,

    I made a mistake, I shouldn’t have told you to edit wp-config.php as the file causing this error is being loaded directly and not via WordPress.

    Change the value of WP_CACHE back to true and add the following in the .htaccess file.

    php_flag display_errors off

    Thread Starter fish911

    (@fish911)

    Hi Jesin
    Ok so I made the changes suggested above but when I go check my site all thats displayed on my website was a hostgator screen with 500 internal server error… So I removed the code above to get the website to return.
    Any more thoughts as to what it might be causing this?

    I really do appreciate your help,
    Roger

    So it looks like your hosting package uses custom php.ini.

    Search for a file named php.ini either inside public_html or a level above it. Edit this file and add or modify (if it exists)

    display_errors = off

    Thread Starter fish911

    (@fish911)

    I used the search tool in hostgator file manager to look for the file php.ini.

    It does not exist in my files.

    If I asked my hosting provider is this something they would do for me?

    Thanks
    Roger

    In that case create a file named php.ini inside /home2/fish and place that line inside it.

    Thread Starter fish911

    (@fish911)

    Ok I created the file php.ini inside of home2/fish but the error is still displaying through the link above.

    Thank you for your patience

    Did you place display_errors = Off in that file?

    Edit .htaccess and place the following at the end

    <IfModule mod_suphp.c>
    suPHP_ConfigPath /home2/fish
    </IfModule>

    If that does not work remove it and place the following in .htaccess

    SetEnv PHPRC /home2/fish/php.ini

    Thread Starter fish911

    (@fish911)

    Ok I tried both examples you suggested above. This time the error message was still displayed but the website did not break this time.

    very puzzling

    Roger

    The php_flag directive isn’t supported on your hosting platform which caused the 500 error.

    I believe the php.ini file still exists with that configuration.

    Tell HostGator support that you want to set PHP display_errors to Off.

    Thread Starter fish911

    (@fish911)

    I will do that and I would like to thank you again for all your help.

    Thanks
    Roger

    Thread Starter fish911

    (@fish911)

    Jensin
    I removed the changes we made and now my site will not load do you have any idea what might of caused this?

    Thread Starter fish911

    (@fish911)

    I fixed it thanks again for your help, I’ll mark this topic resolved…

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Please Help! Call to undefined function get_header() in index.php on line 5’ is closed to new replies.