I have a web server that is running PHP 5.3.6 non thread safe (VC9), running on a server 2008 R2 (iis 7.5) using FastCGI.
I am getting several errors like the one below:
PHP Warning: include_once(\\DB-FUNCTIONS.PHP): failed to open stream: No such file or directory in M:\Depts\uc\uc-template\resources\library\faq-functions.php on line 3
PHP Warning: include_once(): Failed opening 'db-functions.php' for inclusion (include_path='.;D:\php5\extras;D:\php5\pear;D:\php5;N:\orgs;T:\Users;M:\depts;L:\Departments;M:\depts\include;') in M:\Depts\uc\uc-template\resources\library\faq-functions.php on line 3
The file is calling like so: <?php ... include("DB-FUNCTIONS.PHP"); ... ?>
the file exists in the folder, the permissions are set correctly, other include files are working.
I have tracked the problem down to the following
say you have the following folder structure:
/includes
– inc.php
– db.php
-index.php
if index.php includes /includes/inc.php and inc.php calls include(“db.php”) (no include/) then the file will not be found. if you put all the files in one folder it will find them.
is anyone else running into this problem?
I am pasting in a cleaned up version of my php.ini file but i think that everything is set correctly. (sorry for the double spacing … it would all run together otherwise. in order to make the file shorter i have only included variables different that what the default php.ini is set to.)
[PHP]
extension_dir ="D:\PHP5\ext"
short_open_tag = On
asp_tags = Off
register_globals = On
register_long_arrays = On
register_argc_argv = On
post_max_size = 8M
magic_quotes_gpc = On
include_path = ".;D:\php5\extras;D:\php5\pear;D:\php5;M:\depts;M:\depts\include;"
cgi.force_redirect = 0
cgi.fix_pathinfo =1
fastcgi.impersonate = 1;
allow_url_fopen = On
allow_url_include = On
fastcgi.logging =0
extension =php_sqlsrv_53_nts_vc9.dll
extension =php_curl.dll
extension =php_gd2.dll
extension =php_imap.dll
extension =php_oci8.dll
extension =php_openssl.dll
I have looked at several different sites and couldn’t find anything really similar to this problem. This code did work on version 4.4.7 (the web sites were migrated from a 2k3 server runnning iis6 with 4.4.7 in isapi mode)
The include behaviour is expected.
The
.in PHP’s include path only refers to the outermost PHP file, usually the one invoked by the request.If you want to include a file relative to the file doing the including, use the
__DIR__magic constant, eg