2

I have a strange thing, fsockopen works fine with PHP 5.5 on WAMP, but fails with PHP 5.6 (also WAMP, same server).

I am using a library, there is this code:


    $url = parse_url($uri);
    if ('https' == $url['scheme']) {
        $host = 'ssl://'.$url['host'];
        $port = 443;
    } else {
        $host = $url['host'];
        $port = 80;
    }

    $fp = fsockopen($host, $port, $errno, $errstr, 30);
    if (!$fp) {
        throw new WebToPayException(sprintf('Cannot connect to %s', $uri), WebToPayException::E_INVALID);
    }

It returns false (empty), $errno is 0, $errstr is empty.

I've checked differences of enabled PHP extensions, both for 5.5 and 5.6 in WAMP, everything is the same. It's same computer, same Apache server, and there are two PHP versions.

I've Googled for this, but couldn't find the solution. It is something PHP configuration related but I couldn't find what it is.

It would be awesome if someone could help :) Thanks!

Dovis
  • 167
  • 2
  • 12

0 Answers0