If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

PHP 5.2 upgraded to 5.3, problems occurred

Hi all,

My web host has recently upgraded their servers from 5.2.x to 5.3.+ and I am now having some issues with my software (custom-built using PHP).

First of all my login session has suddenly started working incorrectly. Namely, as soon as I login and set the session 'registered_user' to true, after a page refresh or page redirect, the session is gone (note: I use exit(header("Location: "))).

I am also having some issues with the require_once function which I'm using to include Mail.php so I can send mail via PEAR. When I use require_once("Mail.php"), I receive the "no such file or directory" error. I'm assuming PEAR may not be installed on the new build, but my web host did not indicate this was the case when I queried them regarding any changes they made to the server.

Best guess is that they also changed some configuration settings (e.g. include_path?).

I've also found -- not necessarily a version issue -- that if you do a header() redirect, it's a good idea to do a session_write_close() right before it, just to make sure all new/changed session data gets saved.

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

The include path doesn't seem to be an issue here. I've verified with the host that PEAR is installed, yet this problem persists. I've also tried using the session_write_close() function as you recommended, to no avail.

I'm by no means a guru when it comes to PHP so please excuse my ignorance, but simply using require_once("Mail.php") is still a valid include for PEAR in 5.3.+, isn't it? I've never been good at debugging PHP code and I'm really having trouble solving this issue. I'm not even able to revert to PHP 5.2 to get my software working again.

I not even sure if it's safe to assume my issues share a common problem, or if there are a number of things that need changing.

require_once() is fine, but if the include_path setting does not, well, include the path to the directory where that file is, then it won't find it. As a quick, check, just create a little test script (or stick an error_log() in an existing script) to see what the include_path is. (In fact, your require_once error message probably includes that info.)

PHP Code:

echo "<pre>include_path: ".get_include_path()."</pre>";

Just a thought: if they include the version number in the name of the PEAR directory (or its parent directory?), you may just have to change the include path to reflect that name change.

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation

I've managed to get the sessions working properly again by asking the host to provide a new php.ini file for the server. However, this has not fixed the broken include path problem.

The include_path is identical in both the new .ini and the old one. I'm assuming PEAR has been installed in a different directory to the previous PHP build, and the .ini file is not reflecting that change. However, I'm lead to believe one requires root access to the server in order to find out exactly where PEAR is installed?