Binary data in session

php.internals

john

21 years ago
I have been developing a site which stores an image files binary data inside a session variable. Initially, I was developing this site on the following environment: Apache-2.0.52/PHP5.0.3/Windows XP Things worked very well, as I expected them to anyway. I would upload images and they would be manipulated and stored back into the session. I then moved over to my production box: Apache-2.0.54/PHP5.0.4/FreeBSD And everything literally stopped dead in it's track with regards to the session variables and the binary data. Whenever I now upload an image, it is properly stored in session. However, whenever I do session_start(); on any page, it just hangs. In fact, here is the test.php file on which it hung: <?PHP session_start(); ?> Hi // Never gets outputted to browser I've yet to come across other users with this same problem. Furthermore, upon suggestions of co-workers, I have tried to base64 encode before it is serialized by PHP and base64 decode this data when I need to use it. Looking through my /var/tmp directory, I see that in fact the session file is 300KB, which makes sense, since the image I was trying to upload was indeed roughly 300KB. Regards PS, also check out my MySQLi group @ http://groups-beta.google.com/group/MySQLi if ever in need of help with that part of the PHP world :-)

Petar Nedyalkov

21 years ago
On Tuesday 10 May 2005 00:48, john wrote:
> I have been developing a site which stores an image files binary data > inside a session variable. Initially, I was developing this site on the > following environment: > > Apache-2.0.52/PHP5.0.3/Windows XP > > Things worked very well, as I expected them to anyway. I would upload > images and they would be manipulated and stored back into the session. > > I then moved over to my production box: > > Apache-2.0.54/PHP5.0.4/FreeBSD > > And everything literally stopped dead in it's track with regards to the > session variables and the binary data. Whenever I now upload an image, > it is properly stored in session. However, whenever I do > session_start(); on any page, it just hangs. > > In fact, here is the test.php file on which it hung: > > <?PHP > session_start(); > ?> > Hi // Never gets outputted to browser
What does print_r($_SESSION); say. Also, use a debug LogLevel in Apache and check the output in the error_log file.
> > I've yet to come across other users with this same problem. Furthermore, > upon suggestions of co-workers, I have tried to base64 encode before it > is serialized by PHP and base64 decode this data when I need to use it. > > Looking through my /var/tmp directory, I see that in fact the session > file is 300KB, which makes sense, since the image I was trying to upload > was indeed roughly 300KB. > > Regards > > PS, also check out my MySQLi group @ > http://groups-beta.google.com/group/MySQLi if ever in need of help with > that part of the PHP world :-)
-- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436