php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7002 Cannot use the same persistant socket connection from different php scripts
Submitted: 2000-10-04 00:36 UTC Modified: 2000-10-04 00:59 UTC
From: gavin dot wood at hudd dot rage dot co dot uk Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: Windows 98
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gavin dot wood at hudd dot rage dot co dot uk
New email:
PHP Version: OS:

 

 [2000-10-04 00:36 UTC] gavin dot wood at hudd dot rage dot co dot uk
Dear Sirs,
I am using PHP 4.0.1pl2 under Apache with Windows 98.
I am trying to create a persistant sockets connection which I can use from different php files.

I find I can happily send packets to (and receive from) this server from the php script where I open the connection.

However, I cannot pass my file handle across php scripts, or get this working in a different script by holding the file handle in a session variable.

My script temp.
<?php
    $mysocket = pfsockopen ("10.0.0.62", 23, &$errno, &$errstr);
    header ("Location: http://wood/temp2.php ?mysocket=".urlencode($mysocket));
?>

and temp2 which is called from temp.

<?php
fputs ($mysocket, "Hello");
$message= fgets ($mysocket, 256);
?>

The error output is shown below. I have also echoed the file handle. It is Resource id #1.

Warning: Supplied argument is not a valid File-Handle resource in c:/apache/htdocs/temp2.php on line 6

Warning: Supplied argument is not a valid File-Handle resource in c:/apache/htdocs/temp2.php on line 7

Thanks for your time
  Gavin Wood

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-04 00:59 UTC] derick@php.net
This is no bug. Php does not know what $mysocket is in the second script. 
Please ask on the php-general@lists.php.net list your question. (Or on #php on EFNet (IRC))
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Oct 12 08:00:02 2026 UTC