Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

include_path error

Status
Not open for further replies.

curvv

IS-IT--Management
Jan 11, 2001
103
ZA
Hi,

I've got both the cgi and isapi versions of php installed on my win2k server.

When using an include file with cgi version, everything works fine.

When using include file with isapi version, I get the following error:

Warning: Failed opening 'inc/cfg.inc' for inclusion (include_path='php-bin;') in C:\Inetpub\ on line 1

Line 1 in my php file looks like this:

<?php include ('inc/cfg.inc'); ?>

It says include_path = 'php-bin;' but is set to nothing in my php.ini file under C:\winnt.

Any ideas?

thanx
######## CtN ########
 
Try including the full path to the file, or
if your running a web server try a &quot;/&quot; to
signify doc root.

(I found I once had to do this with a win98 file)

Good luck
 
Hi,

In php.ini I set include_path to &quot;.&quot;

Everything is fine now.

thanx ######## CtN ########
 
I am working with IIS and Windows 2000. I am probably missing some fundamentals of finding directories because I get this error;
Warning: Failed opening '../login/checklogin.php' for inclusion (include_path='')

I have two directories in the root of my site;
login and diary

I try to include a file called checklogin.php in the login directory when running a script from the diary directory. In the beginning of the script in the diary directory I have this line;

include(&quot;../login/checklogin.php&quot;);

isn't that right? Would be glad for answers!

Thanks Henrik

PS I tried setting the include_path to &quot;.&quot; but I get the same error DS
 
NOTE FOR EVERYONE IN THIS THREAD:

Please remember that include, include_once, require, require_once use the following order of precidence:

1. check php.ini for DEFAULT include locations (automatically defaults to '.' or current directory).
2. check absolute path concatinated to the location/file directed in the command
3. check relative location to location/file directed in the command.

For added security, you should always set your include_path to a specific location and use that location for all includes. There really should be no exception.

If you don't have access to php.ini and don't want to set it in a .htaccess file OR you are developing apps to be distributed, it is recommended that you ALWAYS use a direct path to your script in these includes/requires.

An example: include_once($DOCUMENT_ROOT.&quot;/my/inc/location/config.inc.php&quot;);

Heck, you can even create a root or global script that gets included which defines globals:

define(INC_PATH,$document_root.&quot;/my/inc/location&quot;);
.....

Chad. ICQ: 54380631
online.dll
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top