I'm having problems with fsockopen command since installing PHP5 (FreeBSD 4.10 system w/Apache 1.3.32).

The following simple fsockopen command now fails:

<?php

$sockfile = '/usr/tmp/.vmailmgrd';
$vmailsock = fsockopen ($sockfile, 0, $errno, $errstr, 20);
if (!$vmailsock) die("Failed to open unix socket file at '$sockfile'<br>\n Error: $errno - $errstr");
?>

It continues to work normally with PHP4. What gives? There doesn't seem to be any hints on the web about fsockopen syntax having been changed between the versions.

The error message produced is as follows:


Warning: fsockopen() [function.fsockopen]: unable to connect to /usr/tmp/.vmailmgrd:0 (Failed to parse address "/usr/tmp/.vmailmgrd") in /usr/web/site31821/htdocs/testsock.php on line 4
Failed to open unix socket file at '/usr/tmp/.vmailmgrd'
Error: 0 - Failed to parse address "/usr/tmp/.vmailmgrd"

That socket file is present and the daemon is running.

Any ideas? Thanks!

    I backed out to PHP 4.3.9 just to make sure that the problem is not system specific - it was not. Once PHP 4.3.9 was installed the the code in my previous message started working normally. Is this a bug, or something specific to my PHP 5.0.2 installation? Can someone confirm whether the same problem occurs (or doesn't occur) on their system?

    I really like many of PHP5's features (OOP, SOAP, more), and would really like to keep it installed... but this item has got to work!

    Thanks!

      4 days later

      The unix socket connection that worked ok with PHP 4.3.9 without any prefix now requires 'unix://' prefix. On the other hand, the 'unix://' prefix doesn't appear to work with 4.3.9. Go figure... the main thing it works 🙂.

      references:
      List of Supported Socket Transports
      my bug report about the issue (now tagged "bogus" :glare: ... but at least 'wes' gave enough info to solve the problem 🙂)

        Write a Reply...