gherson
2008-12-02 22:22:20 UTC
Solution share:
Ran into a problem today with the Zend/Search/Lucene.php's includes of type
require_once 'Zend/Search/Lucene/Exception.php';
These assume that the originally browsed PHP script is in every case exactly
3 folders up from Exception.php. That wasn't the case for me, so in the
script that includes Lucene.php, I wrapped that include in two lines:
ini_set('include_path', '.;' . dirname(__FILE__)); // (Use : instead of
; on Unix.)
require_once 'Zend/Search/Lucene.php';
ini_restore('include_path');
That didn't come to me in an eye blink, though, so maybe a similar ini_set()
and ini_restore() line can be put atop and bottom, respectively, of
Lucene.php?
Similarly, if not as easily, maybe PHP's require('path/to/file') and
include('path/to/file') functions can be given an option to use the
immediate includer's directory as the starting point to 'path/to/file'?
That'd allow me to avoid long-winded
require_once dirname(__FILE__) .
"/path/from/current/file/to/anotherinclude.inc";
statements.
thanks,
George
Ran into a problem today with the Zend/Search/Lucene.php's includes of type
require_once 'Zend/Search/Lucene/Exception.php';
These assume that the originally browsed PHP script is in every case exactly
3 folders up from Exception.php. That wasn't the case for me, so in the
script that includes Lucene.php, I wrapped that include in two lines:
ini_set('include_path', '.;' . dirname(__FILE__)); // (Use : instead of
; on Unix.)
require_once 'Zend/Search/Lucene.php';
ini_restore('include_path');
That didn't come to me in an eye blink, though, so maybe a similar ini_set()
and ini_restore() line can be put atop and bottom, respectively, of
Lucene.php?
Similarly, if not as easily, maybe PHP's require('path/to/file') and
include('path/to/file') functions can be given an option to use the
immediate includer's directory as the starting point to 'path/to/file'?
That'd allow me to avoid long-winded
require_once dirname(__FILE__) .
"/path/from/current/file/to/anotherinclude.inc";
statements.
thanks,
George
--
View this message in context: http://www.nabble.com/include_path-assumption-elimination-tp20802356p20802356.html
Sent from the Zend MFS mailing list archive at Nabble.com.
View this message in context: http://www.nabble.com/include_path-assumption-elimination-tp20802356p20802356.html
Sent from the Zend MFS mailing list archive at Nabble.com.