ID: 42467 User updated by: daniel dot buschke at nextiraone dot de Reported By: daniel dot buschke at nextiraone dot de Status: Open Bug Type: Streams related Operating System: Linux PHP Version: 5CVS-2007-08-29 (snap) New Comment:
here is the test script that shows that socket_create and socket_connect is working: webserver_dev sandbox # cat socks.php <?php define('TCP', 6); $sock = socket_create(AF_INET, SOCK_STREAM, TCP); socket_connect($sock, '69.147.83.196', 80); socket_send($sock, "GET /\n", strlen('GET / HTTP 1.0'), 0); echo socket_read($sock, 100); socket_close($sock); ?> webserver_dev sandbox # socksify php -f socks.php This document is located <a href="/viewvc.cgi/">here</a>. Previous Comments: ------------------------------------------------------------------------ [2007-08-29 11:43:16] daniel dot buschke at nextiraone dot de webserver_dev sandbox # cat fsockopen_timeout.php <?php fsockopen('69.147.83.196', 80, $errno, $errstr, 30); echo "errno: $errno\n"; echo "errstr: $errstr\n"; ?> webserver_dev sandbox # socksify php -f fsockopen_timeout.php PHP Warning: fsockopen(): unable to connect to 69.147.83.196:80 (Operation now in progress) in /www/vhosts/dev/sandbox/fsockopen_timeout.php on line 2 errno: 115 errstr: Operation now in progress of curse it is equal to '1.2.3.4', 99 ------------------------------------------------------------------------ [2007-08-29 11:28:03] [EMAIL PROTECTED] Try this (timeout included) instead: <?php $sock = fsockopen('1.2.3.4', 99, $errno, $errstr, 30); ?> ------------------------------------------------------------------------ [2007-08-29 11:05:24] daniel dot buschke at nextiraone dot de <?php $sock = fsockopen('69.147.83.196', 80); ?> This one trys to connect to an IP of bugs.php.net. Remember that I run this script with socksifiy in front: socksify php -f socksify.php I'm sure it is not easy for you to reproduce this bug. So here is the whole story: I want to connect from Server A (lan) to a Server B (internet). Server A is behind a firewall which drops allmost everything. So if I want to connect to the internet I have to use SOCKS5. Therefore I have to use socksify. socks_create and socks_connect are working fine! So this is not a problem of socksify. But I can not use socks because I want to use ssh2_* buildins which are using the same core functions as fsockopen and which result in same problem. ------------------------------------------------------------------------ [2007-08-29 09:51:18] [EMAIL PROTECTED] I can not reproduce with that one liner. It simply hangs. Obviously you have some bigger script to test with? ------------------------------------------------------------------------ [2007-08-29 09:30:01] daniel dot buschke at nextiraone dot de Description: ------------ When trying to connect to a host via fsockopen and socksify (see dante) I get following: PHP Warning: fsockopen(): unable to connect to 1.2.3.4:99 (Operation now in progress) in /socksify.php on line 15 But "Operation now in progress" is not an error which tolds that connect fails. socket_create and socket_connect are working fine. seems like #39803 but has different version. Patch of #38568 did not work Reproduce code: --------------- <?php $sock = fsockopen('1.2.3.4', 99); ?> Expected result: ---------------- $sock should be an handle which is usable with fread or sth like this $sock !== FALSE Actual result: -------------- PHP Warning: fsockopen(): unable to connect to 1.2.3.4:99 (Operation now in progress) in /socksify.php on line 15 $sock === FALSE ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42467&edit=1