Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    Default setting include_path

    Hi.
    How can I set the include_path for my php include files on westhost?I heard that it is set either in the php.ini file or it in the httpd.conf file.But I dont know which directory these files are in.Can someone give me the path to the files and tell me how to change the setting?

  2. #2
    Senior Member torrin's Avatar
    Join Date
    May 2003
    Location
    Vista, CA
    Posts
    534

    Default

    It looks like include_path is in /etc/php.ini. Just search in that file for include_path and you'll find it. You're probably going to want to backup the file before you make any changes to it. As for how to change it, I would assume that you can just make the change with a regular editor since php.ini is just a text file. I suppose I'm not exactly sure what you're asking. You might have to restart apache. I'm not sure how to do that.

    Oh and for completeness, httpd.conf is in /etc/httpd/conf.

  3. #3
    Senior Member FZ's Avatar
    Join Date
    May 2003
    Location
    Johannesburg, South Africa
    Posts
    1,024

    Default

    Restarting Apache:

    restart
    in an SSH session, or "Restart VPS" in the Site Manager (Site Management > Site Parameters).
    Fayez Zaheer

  4. #4
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,720

    Default

    The only thing I can think about in modifying the include path in your php.ini is that some of WH supplied php stuff may be reliant on where it is currently set. Not sure of this but thought I would mention it in case you change it and find problems with other things.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  5. #5

    Default

    Quote Originally Posted by wildjokerdesign
    The only thing I can think about in modifying the include path in your php.ini is that some of WH supplied php stuff may be reliant on where it is currently set. Not sure of this but thought I would mention it in case you change it and find problems with other things.
    I opened a ticket and asked this question.They told me I can add as many 'additional' paths as I need.Right now I'm a little stuck on how to change the settings.The previous settings in my php.ini file were:

    include_path = ./:/usr/local/lib/php
    I wanted to change it so it looks for files in the folder "var/www/html/my_dir/inc/".So I changed it and the current settings are:
    include_path = ./:/usr/local/var/www/html/my_dir/inc/
    But it doesnt seem to work.Did I change it the right way?

  6. #6
    Senior Member FZ's Avatar
    Join Date
    May 2003
    Location
    Johannesburg, South Africa
    Posts
    1,024

    Default

    I think the colon [:] is necessary to separate the entries. So, your include_path should read:

    include_path = ./:/usr/local/:/var/www/html/my_dir/inc/
    Fayez Zaheer

  7. #7

    Default

    Thanks FZ.That worked but i have a small problem.All of my scripts contain reference to include files in the following format:

    Code:
    include ("dir/file.php");
    assuming the include path is set to var/www/html/my_dirdir/inc/.As you can already guess,the folder "dir" is inside the directory "mydir/inc".But when I've uploaded the scripts they dont work,and I get the error:
    Warning: main() [function.main]: Failed opening 'dir/script.php' for inclusion (include_path='./:/usr/local/:var/www/html/my_dir/inc/')
    This setting worked fine on my local machine but I cant get it to work on West Host.How do you think I should change it?
    I hope I wasnt too confusing

  8. #8
    Senior Member FZ's Avatar
    Join Date
    May 2003
    Location
    Johannesburg, South Africa
    Posts
    1,024

    Default

    Well, I've never used include_path before, so I'm not exactly sure. Maybe it needs you to reference just "file.php" instead of "dir/file.php" and therefore needs you to include the dir/ bit in your include_path. If I had to guess, currently the dir/file.php include is looking for that file relative to where your PHP file is (e.g. /var/www/html) and not relative to your include_path. Like I said, I've never used include_path so I might be wrong.
    Fayez Zaheer

  9. #9
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,720

    Default

    Don't you need the beginning slash on your new include path i.e.
    /var/www/html/my_dir/inc/? Give that a try. Can you add the "dir" to your include_path setting or does that change? You could then just put the file name in the include() since I think what Fayez has to say is correct. I think that it looks in the include_paths you have set and if does not find it there then falls back on looking for it relative to the scritp that callse it.

    I think if you add the beginning slash it'll take care of it.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  10. #10
    Senior Member FZ's Avatar
    Join Date
    May 2003
    Location
    Johannesburg, South Africa
    Posts
    1,024

    Default

    Thanks for catching the missing leading slash, Shawn. I've edited my original post and added it in.
    Fayez Zaheer

Similar Threads

  1. Setting up a "Special" Domain Name
    By rgkopchak in forum General Discussion
    Replies: 1
    Last Post: 03-24-2007, 04:46 AM
  2. Individual accont spam score setting
    By firebirdfan in forum E-mail / FTP Management
    Replies: 0
    Last Post: 01-17-2007, 08:59 PM
  3. setting up - activate encryption?
    By Girl.Geek.Nascent in forum Miva Merchant
    Replies: 4
    Last Post: 12-22-2004, 09:35 PM
  4. Replies: 3
    Last Post: 11-01-2004, 08:42 PM
  5. setting up a mail list with reply-to
    By torrin in forum E-mail / FTP Management
    Replies: 0
    Last Post: 08-06-2004, 09:22 AM

Posting Permissions

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