PHP session handler - current working directory changes before writing session data
-
10-06-2021 - |
Question
I'm using the session_set_save_handler()
function to save the session to a database, I also have an autoloader that relies on the working directory being set to the application directory i.e. chdir('C:\Some\App\Directory')
.
When the session is being written the working directory has changed to my php installation directory i.e. C:\PHP
. This causes the autoloader to fatally error when it tries to require classes related to database persistence. Is there anyway round this?
I am using Zend Framework 1 and Doctrine 2 although I believe this to be a general PHP issue rather than with the libraries themselves.
Solution
I have ended up just make the the paths for the autoloader absolute
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow