Search code examples
websocketphpwebsocket

websockets and PHP basics and initiatives


I have to built a multilayer game using web-sockets. For this I have a a shared web server with Apache. Browser is not an issue I am building for modern browsers only. I tried few example PHP and web-socket source code but no luck. What do I need to do? And also how to enable the PHP socket_create function? Already enables php_sockets extension in the php.ini and also the php_sockets.dll exists in the extension directory. When I call socket_create function php says that this function is undefined.

Any kind of help is appreciated. Thanks


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.