How can a module find a resource in its environment.

From: Date: Sun, 04 Jan 2004 15:09:41 +0000
Subject: How can a module find a resource in its environment.
Groups: php.general 
Request: Send a blank email to php-general+get-173873@lists.php.net to get a copy of this message
Hi, if I understand this correctly, a module looses its context if it is required or included. For example I have a module foo/a.php which is required by b.php via require ("foo/a.php"). Unfortunately within the module a.php the cwd() is not foo but the context of b.php. The easiest way to fix this would be to define a new function my_require() which does a chdir(basename(path)) before the module is included (or one could pass an environment variable if chdir() is deprecated). What is the recommended way for an included or required module to look for a resource? BTW: Why is the syntax so that I have to give the full filename of the module, not only the module name? For example a require("foo/a") should also work, but currently doesn't. I guess PHP currently does not support pre-compiled modules, does it? :) Jost

« previous php.general (#173873) next »