StackOverflowNewbie
StackOverflowNewbie

Reputation: 40643

Run PHP command line, needs socket_create

I have a PHP script that needs to run from command line. One of the function it calls is socket_create.

In php.ini, I have included the following in order to get that function working (see the comment on http://www.php.net/manual/en/sockets.installation.php):

extension=php_sockets.dll

How do I run the script from command line such that it doesn't complain that socket_create is an unknown function? Does PHP CLI actually respect what's in php.ini? I thought it was supposed to, but I do get errors when running it via CLI and no errors when running it via the browser.

UPDATE: by the way, I'm testing this out: https://github.com/nicokaiser/php-websocket. I assume that the server needs to be executed via command line.

Upvotes: 2

Views: 711

Answers (1)

Roadmaster
Roadmaster

Reputation: 5357

A different php.ini file may apply when running php on the CLI rather than as a web server module. You appear to be using Windows, so I'm not sure where this file may be, but it could provide a clue; look for several php.ini files in your disk and see if one of them applies to CLI invocations.

Upvotes: 2

Related Questions