Problem:

I’m working on a wamp system, and have started playing around with sockets. I enabled sockets via the wamp interface:wamp : PHP settings : PHP extensions : php_sockets
and could run my php file via my browser.

When trying to run the same file via the command prompt (start : run : cmd), I got the following error:

Fatal error: Call to undefined function socket_create() in … on line …

Solution:

The command prompt uses a different php.ini file to the apache server.

The Apache php.ini file is accessible via the taskbar icon, and is located at:X:\WAMP INSTALL DIR\Apache2\bin\php.ini

The command prompt php.ini file is located at:X:\WAMP INSTALL DIR\php\php.ini

Once I’d enabled sockets in this file, by uncommenting the line:extension=php_sockets.dll
and restarted the server, everything worked great.