Here's a solution I found upon experiencing an error in WAMP

Scenario

I am using WAMP (wampserver) and trying to run a chat service program via HTML 5 with the use of websockets.

Fatal error: Call to undefined function socket_create() for WAMPServer

I did enable my php_sockets via WAMP interface.

wamp > PHP > PHP Extensions > php_sockets

Upon trying, I received an error from the command prompt saying:

Fatal error: Call to undefined function socket_create() in [FILE] on line [LINE OF CODE]

Solution

It seems that the command prompt was using a different configuration file for PHP.

Apache (or from the WAMP's interface) uses a php.ini that is located at:

[WAMP_DIRECTORY]\bin\apache\Apache2.2.21\bin\php.ini

If you will open this file, you may notice that the line extension=php_sockets.dll is already commented out.

Unfortunately, the CLI or command line interface is using a different configuration file which is located at:

[WAMP_DIRECTORY]\bin\php\php5.3.8\php.ini

In order to resolve it, you should comment out the line extension=php_sockets.dll and save it. Run the program after to see if the websockets again are already up and working.

3 comments :

  1. 1 hour looking for the mistake in my wamp server. Thx so much for this post

    ReplyDelete
  2. All other posts were just time passing. This was great! Thanks

    ReplyDelete
  3. amit parmar5/9/13, 8:27 PM

    thanks was very helpfull

    ReplyDelete