Call to undefined function socket_create() from command prompt


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 …


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:
and restarted the server, everything worked great.

11 Responses to “Call to undefined function socket_create() from command prompt”

  1. John says:

    works great ! Couldn’t find the answer on the web, i’m glad I ran into your blog :D

  2. wath says:

    Yeah!!!!! It worked…. Thanks a lot………..

  3. MOH says:

    its good,
    and add these that after this done,
    restart the wamp server
    good luck

  4. Drew Smith says:

    I’m using EasyPHP and even after editing both copies of php.ini I still got the error. I copied the php.ini file to c:\windows, restarted apache and it worked like a champ.

  5. Matt says:

    Aaah, brilliant. Solved everything! Took me ages to find this – and it wasn’t documented anywhere!
    Thanks again!

  6. Heber says:

    This solved my problem, thanks a lot!

  7. Ivan says:

    I changed both php.ini in wamp directory (D:\wamp\bin\apache\Apache2.2.17\bin and D:\wamp\bin\php\php5.3.5) restarted server and browser and the problem didnt fixed

    Call to undefined function socket_create() in D:\wamp\www\socket\index.php on line 4

  8. Nico says:

    I’ve had other people also telling me it does not work. Seems it works for some and for some not. Anyone else have any ideas?

  9. jesi says:

    Thank you very much.It is very help full.

Leave a Reply to Abraham