0

This is a tricky one to explain. So I'll bullet point it:

  • I have a file that require_once all my settings files and classes ...I call it start.php
  • I require_once that file in my index.php
  • My index.php file then I require_once a another file called home.php

This scripts works perfectly on my localhost server. Now my issue presents itself when I try it on my online server and some functions seem to be working while others are not and I get this error:

Fatal error: Call to undefined function update_display() in /xxxxx/home.php on line 146

Now I know "Fatale error" is because I require_once, but what I don't understand is why some functions seem to be working while others do not?
Also worth mentioning that if I do require_once in my home.php file, it says that I am declaring the function twice!

Any help, much appreciated.

3
  • Are you using file paths everywhere? (No http://) Commented Oct 4, 2011 at 18:55
  • @Pekka - I'm just using relative paths ie functions/start.php Commented Oct 4, 2011 at 18:59
  • 1
    most likely the wrong files are getting included, so try using abs paths (convert relative path to absolute by prepending dirname(__FILE__) . to it (note: dot is for concatenation with the relative path that follows in the code) Commented Oct 4, 2011 at 19:15

2 Answers 2

2

You may use such useful functions as get_included_files and get_include_path to diagnose a problem. Just print their result somewhere (for instance in /xxxxx/home.php just before update_display call). Also you can list defined functions using get_defined_functions(). This will help you to clear up what's actually loaded.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for that. After using the get_included_files, for some strange reason one the files that I included, was not gotten from the same file as all the others. Anyway, it helped me find the error, so thank you a lot!
0

have you tried to convert php starting tags from:

<? 

to:

<?php 

? HTH

2 Comments

Thanks for the input, but I always use <?php ?>
in your webhost's ftp you may have a file called error_log or something, read if there is some error at end of the file

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.