im using a connection to a server in my php script, opened with fsockopen() and i want it to share between different pages so i serialized it and saved it in a session variable but it seems that that ia a bad idea because when i do this nothing happens…
Not even an error.
The problem is that this connection requires a handshake so i cant reconnect everytime
Another question, whats the timeout of fsockopen or does the connection stay alive if the. original php script which called it is closed?
EDIT://
I have a script thats running a long time so it would be possible to keep it open, but my initial question, can i share the handle via $_Session and if yes do i need to serialize it?
because if i echo the handle it isnt an integer
You cannot save that in your session data, when the opening PHP script returns, the process “dies” and your socket goes with it. You may save the integer value from your handle, but it will be no longer valid when the next page is loaded and run.