How do I set include_path in php.ini

Discussion in 'PHP and MySQL' started by windsurfer, Oct 12, 2006.

  1. windsurfer

    windsurfer Perch

    I am having trouble using php.ini. I have an include statement in one of my php files that fails to locate the include file. I am trying to use php.ini to set the include path using the "include_path" directive in the section titled:
    ; Paths and Directories ;

    Is there a way to specify the root web directory for a Windows server (the top level dir as seen by visitors to the site)? Is this the right way to do this?

    Thanks very much.
  2. tanmaya

    tanmaya APAC Operations Staff Member

  3. windsurfer

    windsurfer Perch

    I have tried this but the mapping never happens.

    This statement is in my php.ini.
    include_path = "\library"
    But, the include files aren't found.

    Is it possible that php.ini is not activated?

    I also noticed the .: notation in the example. How is this used? There was no mention of this in the links you sent.

  4. skypanther

    skypanther Exalted Code Master!

    php.ini is on windows only, you have to use a .htaccess on linux or do it with code as tanmaya suggested. Could that be it?

    (I use php.ini frequently on my windows based sites, so I know it does work.)

  5. windsurfer

    windsurfer Perch

    The original problem was that the site was set up on a windows machine, but the code was set to use .htaccess. I requested a php.ini, as suggested by other posts on the jodo forums, and a php.ini was provided. I have been trying to use it, but it seems to be DOA. No matter how I set the include path, the resulting include path seems to point to: include_path='.;c:\php4\pear'

    I have been able to use the ini_set function in a single file. But, I have only been successful in getting a relative path to work. I can't seem to be able to access the home directory.

    • Works: ini_set("include_path", "../../../library");
    • Doesn't work: ini_set("include_path", "/library");
    I also set up a linux version of the site and, in .htaccess, used the absolute path that was provided from the CP of the account. This worked! So, it would seem that I have the option to transfer the site to the linux machine. Probably, I will do that.
    But, it still should be possible to use this code on a Windows machine. Is there someone out there who knows how to specify the home directory for a Windows account in the include_path directive? And also knows why php.ini would fail to work?

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services