Bug #1451: Problems with blocking socket operations

From: Date: Tue, 25 May 1999 18:28:09 +0000
Subject: Bug #1451: Problems with blocking socket operations
Groups: php.dev 
Request: Send a blank email to php-dev+get-5992@lists.php.net to get a copy of this message
From: chr@tv2i.dk Operating system: Red Hat Linux 6.0 PHP version: 3.0.8 PHP Bug Type: Misbehaving function Bug description: Problems with blocking socket operations The following code works on PHP3 versions prior to 3.0.7: $fp = fsockopen('localhost', 25); echo fgets($fp, 256); However, on 3.0.8 it appears not to work. Instead the HTTP connection hangs (Apache server status shows mode W even after HTTP connection is closed by the webbrowser). To make it work on 3.0.8, the following "workaround" can be applied: $fp = fsockopen('localhost', 25); set_socket_blocking($fp, 0); sleep(1); echo fgets($fp, 256); The following also works on 3.0.8 (i.e. the connection is closed by the other part): $fp = fsockopen('localhost', 25); fputs($fp, "quit\n"); echo fgets($fp, 256); Loaded modules: mod_php3, mod_setenvif, mod_unique_id, mod_usertrack, mod_headers, mod_cern_meta, mod_auth_anon, mod_auth, mod_access, mod_alias, mod_userdir, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_referer, mod_log_agent, mod_log_config, mod_env, http_core [PHP_3] engine = On short_open_tag = On asp_tags = On precision = 14 y2k_compliance = Off safe_mode = Off safe_mode_exec_dir = max_execution_time = 30 memory_limit = 8388608 error_reporting = 7 display_errors = On log_errors = Off track_errors = Off warn_plus_overloading = Off magic_quotes_gpc = On magic_quotes_runtime= Off magic_quotes_sybase = Off track_vars = On auto_prepend_file = auto_append_file = include_path = doc_root = user_dir = upload_max_filesize = 5000000 extension_dir = ./ [Syslog] define_syslog_variables = Off [mail function] SMTP = localhost sendmail_from = me@localhost.com sendmail_path = [Debugger] debugger.host = localhost debugger.port = 7869 debugger.enabled = False [SQL] sql.safe_mode = Off [bcmath] bcmath.scale = 0 -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5992) next »