I have been struggling with this all afternoon and I'm, well lats just
say, very pissed off ...
I have a require once in a file. I am passing the fully qualified (i.e.
absolute pathname) to a file that exists on my machine (I'm looking ath
the file now).
I am evaluating the pathname like this (see below)
Contents of app_config.php
=============== ============
<?php
function fix_trailing_ch ar($pathname){
$fixedname = $pathname[strlen($pathnam e)-1] == "/" ? $pathname :
$pathname. "/" ;
return $fixedname;
}
define("DOC_ROO T", fix_trailing_ch ar(dirname($_SE RVER["DOCUMENT_R OOT"])));
define("CLASS_R OOT", DOC_ROOT . "classes/");
define("CONFIG_ ROOT", DOC_ROOT . "global/");
?>
The file below causes errors
=============== ===============
<?php
require_once($_ SERVER['DOCUMENT_ROOT'] . "global/app_config.php" );
require_once(CL ASS_ROOT. "common/somefile.php");
?>
I get this error:
Warning:
require_once(C:/workdir/src/website/classes/common/package.excepti ons.errors.php)
[function.requir e-once]: failed to open stream: No such file or
directory in C:\workdir\src\ website\www\cla sses\auth\MyCon troller.php on
line 11
Fatal error: require_once() [function.requir e]: Failed opening required
'C:/workdir/src/website/classes/common/package.excepti ons.errors.php'
(include_path=' .;C:\workdir\sr c\website\www\; C:\workdir\src\ website\www\cla sses;C:\workdir \src\website\ww w\classes\mystu ff')
in C:\workdir\src\ website\www\cla sses\auth\MyCon troller.php on line 11
For the cynics out there who may think the file does not exist:
C:\workdir\src\ website\www\cla sses\common>dir pack*
Volume in drive C has no label.
Volume Serial Number is 7C79-29A1
Directory of C:\workdir\src\ website\www\cla sses\common
12/05/2008 15:59 5,885 package.excepti ons.errors.php
12/05/2008 16:02 364 package.excepti ons.errors.test .php
2 File(s) 6,249 bytes
0 Dir(s) 6,603,599,872 bytes free
Incidentally, is there any way for me to change the include_path in a
script ?
Looking for some answers quickly before I throw my computer out of the
window (or better still go back to C++ where everything seems to make so
much more sense)
say, very pissed off ...
I have a require once in a file. I am passing the fully qualified (i.e.
absolute pathname) to a file that exists on my machine (I'm looking ath
the file now).
I am evaluating the pathname like this (see below)
Contents of app_config.php
=============== ============
<?php
function fix_trailing_ch ar($pathname){
$fixedname = $pathname[strlen($pathnam e)-1] == "/" ? $pathname :
$pathname. "/" ;
return $fixedname;
}
define("DOC_ROO T", fix_trailing_ch ar(dirname($_SE RVER["DOCUMENT_R OOT"])));
define("CLASS_R OOT", DOC_ROOT . "classes/");
define("CONFIG_ ROOT", DOC_ROOT . "global/");
?>
The file below causes errors
=============== ===============
<?php
require_once($_ SERVER['DOCUMENT_ROOT'] . "global/app_config.php" );
require_once(CL ASS_ROOT. "common/somefile.php");
?>
I get this error:
Warning:
require_once(C:/workdir/src/website/classes/common/package.excepti ons.errors.php)
[function.requir e-once]: failed to open stream: No such file or
directory in C:\workdir\src\ website\www\cla sses\auth\MyCon troller.php on
line 11
Fatal error: require_once() [function.requir e]: Failed opening required
'C:/workdir/src/website/classes/common/package.excepti ons.errors.php'
(include_path=' .;C:\workdir\sr c\website\www\; C:\workdir\src\ website\www\cla sses;C:\workdir \src\website\ww w\classes\mystu ff')
in C:\workdir\src\ website\www\cla sses\auth\MyCon troller.php on line 11
For the cynics out there who may think the file does not exist:
C:\workdir\src\ website\www\cla sses\common>dir pack*
Volume in drive C has no label.
Volume Serial Number is 7C79-29A1
Directory of C:\workdir\src\ website\www\cla sses\common
12/05/2008 15:59 5,885 package.excepti ons.errors.php
12/05/2008 16:02 364 package.excepti ons.errors.test .php
2 File(s) 6,249 bytes
0 Dir(s) 6,603,599,872 bytes free
Incidentally, is there any way for me to change the include_path in a
script ?
Looking for some answers quickly before I throw my computer out of the
window (or better still go back to C++ where everything seems to make so
much more sense)
Comment