I had this bug at work today - won't be able to test it until I get back there after the weekend but thought someone might know the answer offhand.
I have two scripts, file_1.php and file_2.php. They are located in the same folder within my codebase. Said codebase includes many many files, including a global 'header' file which calls several other files and pretty much sets up any file to run on our environment.
What I would like to do is run file_2.php from within a shell_exec()
or exec()
from file_1.php. However, when I do this, file_2.php doesn't recognize the file 'header.php' unless provided with the absolute filepath, and even when it is provided, not all calls to other files (there are several include
s, require
s, etc, in header.php) succeed - though some do.
At the point where I left it, the latest file that was not included had been correctly identified by providing the complete filepath to it as well (as opposed to only the relative one), but I received an 'unidentified function' error on apache_note()
, which is a function bundled with PHP.
I'm running these from the command line, and when I run only test_2.php alone it works fine, but when it is accessed by way of exec()
from file_2.php, this is my situation. Is there something I'm missing about exec()
? Is there a way to run the second file as if in exactly the same environment as the first one? (I tried putenv()
with no success, but perhaps there's a trick involving that?
Help or ideas greatly appreciated, though I won't be able to check for a couple of days. Happy Thanksgiving to all ;)