#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    10
    Rep Power
    0

    include path problems - after uploading to host


    Hi,

    I've recently finished a site using php/mysql - and uploaded it to a new host. I have Apache/php/mysql working fine on my local machine running windows xp.

    Problem here seems to be that all the pages that have php include commands (for database connections) won't work now.

    I know that this is probably down to the include path - and have logged a query with the host provider, but no joy with any support yet. I'm up against a deadline to test the site, which works fine locally.

    The error I'm getting for example is:

    Warning: main(.:/usr/local/lib/php): failed to open stream: No such file or directory in /home/boduwebc/public_html/panozzo/Panozzo_vetrina.php on line 1

    Fatal error: main(): Failed opening required '.:/usr/local/lib/php' (include_path='.:/usr/local/lib/php') in /home/boduwebc/public_html/panozzo/Panozzo_vetrina.php on line 1

    The problem is that I don't understand the include path.

    From the info.php file on the host server:
    include path: .:/usr/local/lib/php

    From the info.php file on my local host:
    .;c:\php4\pear

    For example, on my localhost I have a website folder in htdocs (panozzo), and in this there is a connections folder with the connections file. This works fine as is locally.

    Uploading the site however, to a protected folder, I'm getting the include path errors.

    Can anyone help, either with a solution, or explaining the include path a bit??

    Thanks!!!!

    Andy
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    MD
    Posts
    373
    Rep Power
    15
    I think I may know what your problem is..

    If you are using a shared server then your web host will probably not give you access to the default include path directories. My web host said this was because if they did then every one would have access to those files which would defeat the purpose of putting database control files there.

    So what you need to do is create a directory and change the permissions on the file to 700 or rwx------. Then only you can read the file but they will still work when included. The annoyance of this method (which is unfortunatly unavoidable) is that you must give the direct path to the include file in your code.

    Say I created a file called "include" which is where i will put all my php include files... then in the main page I would access it like this...
    include ("include/db.php");
    Or if you are working on a file that is in a directory then you would need to do this...
    include("../include/db.php");

    And so on... Not as nice as having the file directly in the include path but if you are on a shared host it may be your only option.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    10
    Rep Power
    0

    Thanks - problem sorted!


    Hi Melsana


    Thanks for your help. That sorts the problem out.
    Wish my host tech support team were as efficient!!!!


    Regds,

    Andy

IMN logo majestic logo threadwatch logo seochat tools logo