php ssl connection timeout issue

php ssl connection timeout issue

am 14.05.2009 22:22:40 von Jerry Zhao

--001636283694f13e470469e51625
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi,

I am having trouble connecting to https sites using php's builtin ssl
functions.
I tried:
file_get_contents('https://securesite')
fsockopen('ssl://securesite', 443, $errno, $errstr,20)

and same errors every time:
SSL: connection timeout
Failed to enable crypto

Call to openssl_error_string() returns no error.
Curl worked both within php and as standalone client.
The strange thing is that the connection seemed to be dropped immediately
upon contact with the server, i.e., the call to the above functions failed
immediately, which I think contradicts the "timeout" error.

Any tips on the cause of this issue or how to debug this is appreciated.

Regards,

Jerry.

--001636283694f13e470469e51625--

Re: php ssl connection timeout issue

am 14.05.2009 23:43:12 von Shawn McKenzie

Jerry Zhao wrote:
> Hi,
>
> I am having trouble connecting to https sites using php's builtin ssl
> functions.
> I tried:
> file_get_contents('https://securesite')
> fsockopen('ssl://securesite', 443, $errno, $errstr,20)
>
> and same errors every time:
> SSL: connection timeout
> Failed to enable crypto
>
> Call to openssl_error_string() returns no error.
> Curl worked both within php and as standalone client.
> The strange thing is that the connection seemed to be dropped immediately
> upon contact with the server, i.e., the call to the above functions failed
> immediately, which I think contradicts the "timeout" error.
>
> Any tips on the cause of this issue or how to debug this is appreciated.
>
> Regards,
>
> Jerry.
>

Check phpinfo(). What is listed for Registered PHP Streams and
Registered Stream Socket Transports. Also, is openssl listed under
extensions?

--
Thanks!
-Shawn
http://www.spidean.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php ssl connection timeout issue

am 14.05.2009 23:57:24 von Nathan Rixham

Jerry Zhao wrote:
> Hi,
>
> I am having trouble connecting to https sites using php's builtin ssl
> functions.
> I tried:
> file_get_contents('https://securesite')
> fsockopen('ssl://securesite', 443, $errno, $errstr,20)
>
> and same errors every time:
> SSL: connection timeout
> Failed to enable crypto
>
> Call to openssl_error_string() returns no error.
> Curl worked both within php and as standalone client.
> The strange thing is that the connection seemed to be dropped immediately
> upon contact with the server, i.e., the call to the above functions failed
> immediately, which I think contradicts the "timeout" error.
>
> Any tips on the cause of this issue or how to debug this is appreciated.
>
> Regards,
>
> Jerry.
>

assuming you've checked for mod_ssl and tried connecting up to an ssl
server you know works fine?

then check for bad ssl certificates on the remote server.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php ssl connection timeout issue

am 15.05.2009 00:03:18 von Jerry Zhao

--001636283694d7a2d20469e67e01
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I tried different combination of ssl clients and servers, it all points to
problems on the client side of my new php build. The same code worked on an
older php build.


On Thu, May 14, 2009 at 4:57 PM, Nathan Rixham wrote:

> Jerry Zhao wrote:
>
>> Hi,
>>
>> I am having trouble connecting to https sites using php's builtin ssl
>> functions.
>> I tried:
>> file_get_contents('https://securesite')
>> fsockopen('ssl://securesite', 443, $errno, $errstr,20)
>>
>> and same errors every time:
>> SSL: connection timeout
>> Failed to enable crypto
>>
>> Call to openssl_error_string() returns no error.
>> Curl worked both within php and as standalone client.
>> The strange thing is that the connection seemed to be dropped immediately
>> upon contact with the server, i.e., the call to the above functions failed
>> immediately, which I think contradicts the "timeout" error.
>>
>> Any tips on the cause of this issue or how to debug this is appreciated.
>>
>> Regards,
>>
>> Jerry.
>>
>>
> assuming you've checked for mod_ssl and tried connecting up to an ssl
> server you know works fine?
>
> then check for bad ssl certificates on the remote server.
>

--001636283694d7a2d20469e67e01--

Re: php ssl connection timeout issue

am 15.05.2009 00:05:00 von Nathan Rixham

Jerry Zhao wrote:
> I tried different combination of ssl clients and servers, it all points to
> problems on the client side of my new php build. The same code worked on an
> older php build.
>

checked the output of print_r( stream_get_wrappers() );?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php ssl connection timeout issue

am 15.05.2009 00:14:20 von Jerry Zhao

--0016362836d653d0790469e6a6d4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham wrote:

> Jerry Zhao wrote:
>
>> I tried different combination of ssl clients and servers, it all points to
>> problems on the client side of my new php build. The same code worked on
>> an
>> older php build.
>>
>>
> checked the output of print_r( stream_get_wrappers() );?


Array ( [0] => php [1] => file [2] => data [3] => http [4] => ftp [5] =>
compress.bzip2 [6] => https [7] => ftps [8] => compress.zlib )

--0016362836d653d0790469e6a6d4--

Re: php ssl connection timeout issue

am 15.05.2009 00:17:46 von Nathan Rixham

Jerry Zhao wrote:
> On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham wrote:
>
>> Jerry Zhao wrote:
>>
>>> I tried different combination of ssl clients and servers, it all points to
>>> problems on the client side of my new php build. The same code worked on
>>> an
>>> older php build.
>>>
>>>
>> checked the output of print_r( stream_get_wrappers() );?
>
>
> Array ( [0] => php [1] => file [2] => data [3] => http [4] => ftp [5] =>
> compress.bzip2 [6] => https [7] => ftps [8] => compress.zlib )
>

so you've got ssl support, next up you visited the url in a browser to
check the ssl certificate? odds are it's invalid and that an exception
has been made on the old php server

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: php ssl connection timeout issue

am 15.05.2009 15:48:37 von Jerry Zhao

--0016363108ab928d230469f3b3dc
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Thu, May 14, 2009 at 5:17 PM, Nathan Rixham wrote:

> Jerry Zhao wrote:
>
>> On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham wrote:
>>
>> Jerry Zhao wrote:
>>>
>>> I tried different combination of ssl clients and servers, it all points
>>>> to
>>>> problems on the client side of my new php build. The same code worked on
>>>> an
>>>> older php build.
>>>>
>>>>
>>>> checked the output of print_r( stream_get_wrappers() );?
>>>
>>
>>
>> Array ( [0] => php [1] => file [2] => data [3] => http [4] => ftp [5] =>
>> compress.bzip2 [6] => https [7] => ftps [8] => compress.zlib )
>>
>>
> so you've got ssl support, next up you visited the url in a browser to
> check the ssl certificate? odds are it's invalid and that an exception has
> been made on the old php server


No, the certificates are valid.

--0016363108ab928d230469f3b3dc--