php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76856 When i called stream_socket_client gives error message of
Submitted: 2018-09-10 12:51 UTC Modified: 2018-09-10 14:42 UTC
From: sushil dot adsare at konnet dot co dot in Assigned: cmb (profile)
Status: Not a bug Package: Streams related
PHP Version: 5.6.37 OS: windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
22 + 13 = ?
Subscribe to this entry?

 
 [2018-09-10 12:51 UTC] sushil dot adsare at konnet dot co dot in
Description:
------------
---
From manual page: http://www.php.net/function.stream-socket-client
---

    $socket = stream_socket_client($client,$errorno, $errorstr, $timeout);
     
              Comment Code Just for U r info
              //$socket = stream_socket_client('tcp://127.0.0.1:7014',$errorno, 
                                               $errorstr, $timeout);


    echo($errorstr." errorstr!!!\n");

    /* Set the timeout */ 
    stream_set_timeout($socket, $timeout);
    /* Send the command */ 
    if(!fwrite($socket, $snd_msg))
    {
       echo($client." Error while writing!!!\n");
    }

    if (!($rcv_msg = fread($socket, 1024))) 
    {
       echo($client." Error while reading!!!\n");
    }
    else 
    {
    }

errorstr echo print error Message - 
no connection could be made because the target machine actively refused it


and also give another error in html format on cmd

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS 10.0 Detailed Error - 405.0 - Method Not Allowed</title>


</head>
<body>
<div id="content">
<div class="content-container">
  <h3>HTTP Error 405.0 - Method Not Allowed</h3>
  <h4>The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.</h4>
</div>
<div class="content-container">
 <fieldset><h4>Most likely causes:</h4>
  <ul>  <li>The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle
the request.</li>       <li>A request was sent to the server that contained an invalid HTTP verb.</li>  <li>The request
is for static content and contains an HTTP verb other than GET or HEAD.</li>    <li>A request was sent to a virtual dire
ctory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET
 or HEAD.</li> </ul>
 </fieldset>
</div>
<div class="content-container">
 <fieldset><h4>Things you can try:</h4>
  <ul>  <li>Verify the list of verbs enabled for the module handler this request was sent to, and ensure that this verb
should be allowed for the Web site.</li>        <li>Check the IIS log file to see which verb is not allowed for the requ
est.</li>       <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about
 creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </l
i> </ul>
 </fieldset>
</div>

<div class="content-container">
 <fieldset><h4>Detailed Error Information:</h4>
  <div id="details-left">
   <table border="0" cellpadding="0" cellspacing="0">
    <tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;StaticFileModule</td></tr>
    <tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr>
    <tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;StaticFile</td></tr>
    <tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x80070001</td></tr>

   </table>
  </div>
  <div id="details-right">
   <table border="0" cellpadding="0" cellspacing="0">
    <tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;http://localhost:80/iisstart.htm</td></tr>
    <tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;C:\inetpub\wwwroot\iisstart.htm</td></tr>
    <tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr>
    <tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr>

   </table>
   <div class="clear"></div>
  </div>
 </fieldset>
</div>

<div class="content-container">
 <fieldset><h4>More Information:</h4>
  This error means that the request sent to the Web server contained an HTTP verb that is not allowed by the configured
module handler for the request.
  <p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=405,0,0x80070001,14393">View more information
&raquo;</a></p>

 </fieldset>
</div>
</div>
</body>
</html>



I just send data send info though socket.
this code is working previously but after system update it shows error.
i know it may be any permission issue but i don't understand.
i tries some 
 1 add all feature in iis 10
 2 add http handler mapping(verbs)in my server website which is host on iis 10






Test script:
---------------
function send_anx_app_msg($client)
{
    $rcv_msg = "";
    $timeout = 10;
    $snd_msg = "STATUS_MONITOR";
       
    $socket = stream_socket_client($client,$errorno, $errorstr, $timeout);
     //$socket = stream_socket_client('tcp://127.0.0.1:7014',$errorno, $errorstr, $timeout);

    echo($errorstr." errorstr!!!\n");

    /* Set the timeout */ 
    stream_set_timeout($socket, $timeout);
    /* Send the command */ 
    if(!fwrite($socket, $snd_msg))
    {
       echo($client." Error while writing!!!\n");
    }

    if (!($rcv_msg = fread($socket, 1024))) 
    {
       echo($client." Error while reading!!!\n");
    }
    else 
    {
    }
    fclose($socket);
    return $rcv_msg;
}

Expected result:
----------------
it just connect and send on socket 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-10 14:42 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2018-09-10 14:42 UTC] cmb@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
(note that PHP 5.6 and 7.0 are no longer actively supported,
see <http://php.net/supported-versions.php>)

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC