Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Dec 2002
    Location
    the windy city
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts

    include file above root

    i'm trying to place a file that contains db connection code above the root directory.

    created a file conn.php
    placed it in usr/local/lib/php/test

    in php.ini i uncommented
    ; UNIX: "/path1:/path2"
    include_path = ".:/php/test"

    resterted apache.

    but my code won't work.

    Warning: main(conn.php) [function.main]: failed to create stream: No such file or directory in /usr/local/etc/httpd/htdocs/2003_site/resources/php/navigation.php on line 9

    Warning: main() [function.main]: Failed opening 'conn.php' for inclusion (include_path='.:/php/includes') in /usr/local/etc/httpd/htdocs/2003_site/resources/php/navigation.php on line 9
    error2_1

    the syntax i'm using for inclusion is
    include 'conn.php';

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try

    include_once('/usr/local/lib/php/test/conn.php');
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    What's the .: do? I don't think I've ever seen that

  • #4
    Regular Coder
    Join Date
    Dec 2002
    Location
    the windy city
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Nightfire
    What's the .: do? I don't think I've ever seen that
    http://www.php.net/manual/en/configu...i.include-path

    this is the way it was in teh php.ini file before i uncommented that line (well, and of course the directory name "test" was also modified by me)

  • #5
    Regular Coder
    Join Date
    Dec 2002
    Location
    the windy city
    Posts
    140
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok,
    what finally worked was
    in php.ini:

    ; UNIX: "/path1:/path2"
    include_path = ".:/usr/local/lib/php/test"

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Nightfire
    What's the .: do? I don't think I've ever seen that
    They separate different directories from which files may be included, i.e. PHP first tries to search in the first directory for the desired file, then in the second after the colon, etc.
    Some hosts use a centralized PEAR directory. For this usage the ability to provide several directories is crucial.
    De gustibus non est disputandum.

  • #7
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,081
    Thanks
    11
    Thanked 99 Times in 97 Posts
    Originally posted by Nightfire
    What's the .: do? I don't think I've ever seen that
    you probably have but on win32 the seperator is ';' so

    include_path = ".;c:/why/colon/wont/workonwin32;/nother_path"

    means look in '.' (same directory) or c:/why/colon/wont/work... etc
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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