# Binary data in session

- Thread: https://externals.io/message/16187
- Original archive: https://news-web.php.net/php.internals/16187
- Started by john on 2005-05-09T21:48:22+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #16187 — john — 2005-05-09T21:48:22+00:00

URL: https://externals.io/message/16187#16187

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 :-)

---

## #16190 — Petar Nedyalkov — 2005-05-10T07:22:11+00:00

URL: https://externals.io/message/16187#16190 · In reply to: #16187

> 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
