SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Include makes my whole page disappear...

    Hi all,

    I'm trying to include a file with some custom functions. The functions.php page has a list of includes that pull in each function.

    It's not doing this on my local machine, only when I upload and test on the hosting server.

    if I add this line,

    include 'lib/functions/functions.php';

    it makes my page white with no html output at all. There are no errors, nothing.

    I take that include out and all works like normal...except without my functions.

    Any ideas why? Thanks!
    No, I REALLY dislike having to use Joomla.

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Most likely the path you specify is incorrect, it makes the script fail, but error display is off and thus there's no output at all.

    Add this to the top of your script:
    PHP Code:
    ini_set('display_errors'1);
    error_reporting(E_ALL); 
    Saul

  3. #3
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I've double checked my paths. I guess the mod_rewrite is having something to do with it.
    No, I REALLY dislike having to use Joomla.

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    mod_rewrite has nothing to do with includes, the includes work behind the webserver on file system and it doesn't effect it at all.

    Try adding the lines.
    Saul

  5. #5
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The error reporting isn't working

    nothing shows up still.
    Last edited by crowden; Nov 12, 2007 at 14:53. Reason: wrong button pushed
    No, I REALLY dislike having to use Joomla.

  6. #6
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hm, that might be the case if there's a syntax error. Are you sure you're not making any?

    Perhaps the php versions on your localhost and the production server differ?
    Saul

  7. #7
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, I decided to restructure my files...

    I put the functions.php file up one directory into lib/ which did the trick.

    I usually don't have troubles with directory paths, but this one has me stumped. ah well, it works now.
    No, I REALLY dislike having to use Joomla.

  8. #8
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ah, well there you go. Perhaps you should use absolute paths?

    PHP Code:
    include dirname(__FILE__).'/lib/functions/functions.php'
    That might solve all the path madness.
    Saul

  9. #9
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by php_daemon View Post
    Perhaps the php versions on your localhost and the production server differ?
    I believe they are actually, now that you mention it. I'll have a look into that. I hate it when clients don't host with us cause then I have to deal with this stuff.

    At any rate, it's working now. Thanks again for the tips.
    No, I REALLY dislike having to use Joomla.

  10. #10
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Charge them more!

    You're very welcome
    Saul


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
  •