Forum Moderators: coopster

Message Too Old, No Replies

fsockopen fails after upgrade to PHP 4.4.1

         

FalseDawn

1:22 am on Mar 2, 2006 (gmt 0)

10+ Year Member



I recently upgraded PHP on my VPS, and noticed that a script I use for paypal IPN has stopped working.

On further investigation, it seems that the fsockopen() command is no longer functioning.

code:
<?php

$fp=fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);

if (!$fp)
{
echo ('error=' . $errno);
echo'<br>';
echo ('errorstr=' . $errstr);
}
?>

Now the weird thing is that I get different output when I run the same exact code on different domains.

In most cases, $errno is 0 (zero) and $errstr is "Success", even though it clearly has failed.

Accoring to PHP.net, this indicates "failure to initialize the socket", although gives no indication of why or how to troubleshoot it.

In other cases, I get "13 - Permission Denied" returned.

I really have no clue how to fix this - hours of searching have turned up nothing conclusive.

Clearly, something in the PHP upgrade has changed a setting somewhere, as the script has not been changed.

(by the way, it says sockets support is compiled in and enabled, and open SSL support is enabled.)

I'm really running out of ideas here. Could it be a permission I need to reset in apache somehow? I'm not running phpsuexec as I only have my accounts on the VPS.
I am going to try restarting my VPS at some point, too.

coopster

4:10 am on Mar 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I noticed a couple of socket bugs back in Nov 2005. Have you considered rolling up to 4.4.2?

FalseDawn

5:21 am on Mar 2, 2006 (gmt 0)

10+ Year Member



I am going to try rebooting the machine first, then I will try 4.4.2 and report back.

FalseDawn

9:17 am on Mar 2, 2006 (gmt 0)

10+ Year Member



Well a reboot didn't help, but an upgrade to 4.4.2 fixed the problem, so it was most likely a bad PHP build, since there don't appear to be any widespread reports of socket bugs in 4.4.1

coopster

7:54 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Thanks for the report ... this one had me stumped so I was hoping it was a bug ;)