WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Please Help! Call to undefined function get_header() in index.php on line 5 (20 posts)

  1. fish911
    Member
    Posted 3 months ago #

    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/

  2. Jesin A
    Member
    Posted 3 months ago #

    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.

  3. fish911
    Member
    Posted 3 months ago #

    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

  4. fish911
    Member
    Posted 3 months ago #

    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?

  5. Jesin A
    Member
    Posted 3 months ago #

    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

  6. fish911
    Member
    Posted 3 months ago #

    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

  7. Jesin A
    Member
    Posted 3 months ago #

    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

  8. fish911
    Member
    Posted 3 months ago #

    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

  9. Jesin A
    Member
    Posted 3 months ago #

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

  10. fish911
    Member
    Posted 3 months ago #

    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

  11. Jesin A
    Member
    Posted 3 months ago #

    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

  12. fish911
    Member
    Posted 3 months ago #

    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

  13. Jesin A
    Member
    Posted 3 months ago #

    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.

  14. fish911
    Member
    Posted 3 months ago #

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

    Thanks
    Roger

  15. fish911
    Member
    Posted 3 months ago #

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

  16. fish911
    Member
    Posted 3 months ago #

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

  17. Jesin A
    Member
    Posted 3 months ago #

    But PHP's display_error is still On, so ask Hostgator to turn it off.

  18. fish911
    Member
    Posted 3 months ago #

    Hey Jensin
    Good morning!
    Yeah I'm doing that today. I was on chat with hostgator yesterday and they suggested to have my themes author look at the error first. So I did but his conclusion was the same as yours. It's a bot / search engine trying to access it.. No big problem..

    I'll will have them turn it off today.

    Thanks
    Roger

  19. Jesin A
    Member
    Posted 3 months ago #

    Good morning Roger.

    Yes there is absolutely nothing wrong with with the theme. WordPress themes are meant to be accessed through WordPress so if their files are accessed directly they won't have the required functions defined.

    Try accessing the files header.php and footer.php in the same way and you will see different errors!

    BTW there is an extra n in my name :-D

  20. fish911
    Member
    Posted 3 months ago #

    Exactly right Jesin, different error message when trying to access the header.php and footer.php. in the same fashion.
    I'll be changing that as soon as I have time to chat with hostgator.

    Thanks for the lesson..
    Sorry about the name typo.. :-)

    Roger

Reply

You must log in to post.

About this Topic