3

I tried to run in my localhost (WAMP) a php code with a socket,and it work great in the browser ,but whan i tried to do the same in the command line it's throw exception "the function socket_create is not exists" . So I tried to check if php_sockets extintion is enabled and it is,so it still doesn't work ,someone has crossed with that before ? here is the exception :

PHP Fatal error: Call to undefined function socket_create() in C:\wamp\www\sock et\serverc.php on line 2 PHP Stack trace: PHP 1. {main}() C:\wamp\www\socket\serverc.php:0

Fatal error: Call to undefined function socket_create() in C:\wamp\www\socket\se rverc.php on line 2

Call Stack: 0.0010 230696 1. {main}() C:\wamp\www\socket\serverc.php:0

Viktor S.
  • 12,736
  • 1
  • 27
  • 52
asafg8
  • 69
  • 8
  • 4
    Maybe there is a different php.ini for cli (see http://stackoverflow.com/questions/2750580/how-to-find-the-php-ini-file-used-by-the-command-line) – Luca Rainone Jan 10 '13 at 13:28
  • maybe ,but you know where in wamp this folder located ? – asafg8 Jan 10 '13 at 13:32
  • 3
    execute this line `php -i | grep 'Configuration File'` – Luca Rainone Jan 10 '13 at 13:33
  • sorry i didnt notice ... php -i | find /i "Configuration File" Configuration File (php.ini) Path => C:\Windows Loaded Configuration File => C:\wamp\bin\php\php5.4.3\php.ini i eduted the second one (i think ) .. and i didnt found the first one... – asafg8 Jan 10 '13 at 13:35
  • never mind Probably windoes re edit this file or somthing – asafg8 Jan 10 '13 at 13:39

1 Answers1

0

PHP in CLI mode on Windows uses the php.ini file located in C:\Windows (see http://php.net/manual/en/configuration.file.php). So check here if php_socket is enabled.

Epoc
  • 7,208
  • 8
  • 62
  • 66