Re: PHP fsockopen with the UNIX abstract namespace

From: Date: Wed, 13 Feb 2008 22:10:55 +0000
Subject: Re: PHP fsockopen with the UNIX abstract namespace
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-269262@lists.php.net to get a copy of this message
@4u schreef:
Hi, thanks for your help - unfortunately it doesn't help. With "stream_socket_client ()" I get the message "unable to connect to unix://\0/tmp/hald-local/dbus-ZniNmvr5O0 (Connection refused) in /root/dbus_session.php on line 272" which is at least better, because it shows the full path.
is the connection refused a permissions thing here? can you verify that it's possible to connect? you might consider attaching php to gdb and seeing where things go wrong, if the socket itself is fine and usable and your sure then a bug report is in order, no? maybe someone smarter cares to comment.
I verified it with PHP 5.1.2 (cli) (built: Jul 17 2007 17:32:48) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies (It's a Debian based machine) and PHP 5.2.5-pl1-gentoo (cli) (built: Dec 29 2007 11:46:44) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with eAccelerator v0.9.5.1, Copyright (c) 2004-2006 eAccelerator, by
eAccelerator (Gentoo) socket_create and socket_connect produces the following error: Warning: socket_connect() [function.socket-connect]: unable to connect [22]: Invalid argument in ... again verified on both systems and definitely with the right arguments - the socket resource and a "[NUL]/tmp/path" string as written in the PHP manual. Are their other solutions or known problems? If not, I will maybe post it as a bug - but wanted to make sure that it's not my fault. Jochem Maas schrieb:
@4u schreef:
Hi, I have a problem with fsockopen in connection with the UNIX abstract namespace. To open a UNIX socket in the abstract namespace I have to add a nul byte in front of the path. Unfortunately PHP returns fsockopen() [function.fsockopen]: unable to connect to unix://:0 (Connection refused) for unix://\x00/tmp/dbus-whatever which is a bit strange because I expected at least the error message "fsockopen() [function.fsockopen]: unable to connect to unix://[NUL byte]/tmp/dbus-whatever:0 (Connection refused)"
your problem might be version related, but php does have a C level function php_stream_sock_open_unix() explicitly for the issue of the NUL byte (the NUL byte is seen as the end of a string, unless the string handling is binary safe - if I got the lingo correct). my first guess would be to use socket_create() in combination with socket_connect() instead of fsockopen() and see if that does the trick.
Is this a known issue or do I have to set something in the php.ini? I would appreciate any ideas how to debug this issue.


« previous php.general (#269262) next »