SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    Wales
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why am I seeing Fatal Error: Call to undefined...

    ...function: my_function()?

    Strange one this, or is it me? A site is working fine on my machine (local) but after I upload I see these errors, Fatal calls to functions that I've made. The same site is working on the same server the only difference is that the one that works is at www.rootlevel.com and the one that doesn't is at www.rootlevel/subdir/ will that make a difference? Other things like refs to images and css and the like work fine.

    Help!

    Rob

    p.s. the domains above are fictitious if you had not already guessed!

  2. #2
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How are you including files? Post some code

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    Toronto
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are these functions in a separate file that you are include()ing?
    If so, make sure to include the full, or relative path to the functions file

    ie, in /subdir
    PHP Code:
    include("../functions.php"); 

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    Wales
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is an example of the code I'm using to include files:

    <?php include_once ('4dm1n/includes/configuration.php');
    include_once ('includes/header.php');
    require_once ('classes/database/database.php');
    require_once ('classes/images.php');
    require_once ('classes/functions.php');
    $database = new database();
    $dbLink = $database->databaseConnect();
    $images = new images(); ?>

    I guess I'm going wrong here then? It seems to make sense as the site works ok at root level but not within a subdir. Are these not relative then?

    Rob

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    Toronto
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When the script is called in /subdir, it is looking for a "4dm1n", "classes" and "includes" directory within that sub-directory.

    You need to look for the files in

    include("../classes/functions.php");

    or the full path: i.e.:

    include("/public_html/classes/functions.php");

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    Wales
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahh, yes I see. I'll give this a try and see what happens.

    Thanks

    Rob

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    Wales
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    8nerd, just tried that but no go. Thinking about what you wrote those folders (4dm1n etc.) are within a subdirectory. This is the structure:

    www.domain.co.uk
    www.domain.co.uk/subdirectory/
    www.domain.co.uk/subdirectory/index.php
    www.domain.co.uk/subdirectory/4dmin/
    www.domain.co.uk/subdirectory/classes/

    All this sites files are in this subdirectory so those includes should work. Most of the site works except for certain calls to the database class.

    $database -> show_opening();

    This one throws up an error.

    This code can be found in an include

    include ('includes/left.php');

    But other stuff within that include is ok!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •