|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23618 stream_set_timeout() doesn't work for ssl://
Submitted: 2003-05-13 18:23 UTC Modified: 2003-07-29 07:25 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: waboring at 3gstech dot com Assigned: wez (profile)
Status: No Feedback Package: Sockets related
PHP Version: 4.3.1 OS: linux redhate 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: waboring at 3gstech dot com
New email:
PHP Version: OS:


 [2003-05-13 18:23 UTC] waboring at 3gstech dot com
stream_set_timeout() doesn't seem to work when using fsockopen("ssl://<some host here", 443, $errno, $errstr);

My example code

In my real test I am using an web server on my net that does some processing in a script and over time spits me back info.  This script shows a test calling in ssl:// mode and non ssl mode.  

I never the timeouts when using ssl://, but I do when using non-ssl fsockopen connections.


$url = "/";
$scan_host = "";

//$fp = fsockopen("ssl://".$scan_host, 443, $errno, $errstr, 5);
$fp = fsockopen($scan_host, 80, $errno, $errstr, 5);
if (!$fp) {
    echo "$errstr ($errno)<br>\n";
} else {    
    $header = "GET ".$url." HTTP/1.0\r\nHost: ".$scan_url."\r\n";
    $header .= "Connection: close\r\n\r\n";

    fputs ($fp, $header);
    stream_set_timeout($fp, 0,500);

    $keep_alive = time();
    while (!feof($fp)) {
        $str = fgets ($fp,1024);        
        if (strlen($str) > 0) {
            echo "got '$str'<br>";
        $stream_info = stream_get_meta_data( $fp );
        if ($stream_info["timed_out"]) {
            //the stream timed out
            echo "KEEP-ALIVE<br>";

        if (time() - $keep_alive >= 30) {
            echo "keep-alive<br>";
            $keep_alive = time();
    fclose ($fp);



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-15 19:01 UTC]
Working on a fix
 [2003-07-25 08:38 UTC]
Please try using this CVS snapshot:
For Windows:

The test script appears to work correctly using the latest CVS.
 [2003-07-29 07:25 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 13 03:02:22 2024 UTC