#49166 [Opn->Fbk]: called to undefined function socket_create

From: Date: Wed, 05 Aug 2009 21:47:03 +0000
Subject: #49166 [Opn->Fbk]: called to undefined function socket_create
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140697@lists.php.net to get a copy of this message
ID: 49166 Updated by: jani@php.net Reported By: s dot daudell at boldwebservices dot com -Status: Open +Status: Feedback Bug Type: Sockets related Operating System: Windows XP Pro PHP Version: 5.3.0 New Comment: It's not really loaded if the function doesn't exist, try this: <?php var_dump(extension_loaded("sockets")); ?> Previous Comments: ------------------------------------------------------------------------ [2009-08-05 15:29:05] s dot daudell at boldwebservices dot com i commented out all of my other code and inserted only the script you provided. it still results in a fatal error. I check the phpinfo() output once again, still says sockets support enabled. ------------------------------------------------------------------------ [2009-08-05 14:32:29] jani@php.net It's quite impossible for this function not exist if the sockets extensions is really loaded. Please check again. And this time with this script: <?php error_reporting(E_ALL); $foo = socket_create(AF_INET, SOCK_STREAM, 0); ?> ------------------------------------------------------------------------ [2009-08-05 08:05:48] s dot daudell at boldwebservices dot com As i mentioned, sockets are enabled, the extension shows up as loaded, in the WAMP interface, in phpinfo(), and in php.ini However when the function is called, it results in a fatal error. This same script worked fine in 5.2.6 I was installing my software on a new machine with the newer version of PHP, following my same setup procedures that worked before, and now it doesnt work. ------------------------------------------------------------------------ [2009-08-05 07:36:36] jani@php.net Wild guess: sockets extension isn't loaded? Check your phpinfo() output. ------------------------------------------------------------------------ [2009-08-05 04:14:01] s dot daudell at boldwebservices dot com Description: ------------ I just installed a newer version of WAMP, with php 5.3.0 and enabled sockets. This script has worked fine on older versions of php, but now is coming up with an 'called to undefined function socket_create();' error Reproduce code: --------------- //-- Set some variables $host = "192.168.1.103"; $port = 9001; //-- Create socket $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); //-- Bind socket to port socket_bind($socket, $host, $port) or die("Could not bind to socket\n"); echo "Binded to server address: ".$host."\r\n"."On port: ".$port."\r\n\r\n"; //-- Start listening for connections socket_listen($socket, 3) or die("Could not set up socket listener\n"); echo "Waiting for connections...\r\n"; Expected result: ---------------- It should start listening for raw text to come in on that data. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49166&edit=1

« previous php.bugs (#140697) next »