Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Fatal error: Call to undefined function socket_create()" even though enabled in php.ini

Tags:

php

sockets

I have a weird PHP problem. I am running PHP 5 on IIS in Windows 7. When I make a call to socket_create in my PHP file, like so:

$sock = socket_create(AF_INET, SOCK_DGRAM, getprotobyname('udp'));

I get the following error:

Fatal error: Call to undefined function socket_create() ...

I have tried everything, ranging from enabling extension=php_sockets.dll in php.ini, php.ini-development and php.ini-production to restarting IIS and rebooting my computer.

However, I keep getting the same error and am confused. So far I have found no solution on the internet, as I have tried everything.

Also worth of mentioning. The dll is clearly installed in one of the subfolders.

Any ideas?

Thanks

like image 895
sockfd2 Avatar asked Oct 12 '25 13:10

sockfd2


1 Answers

Type in the following command from your command line:

php --ini

That will tell you which php.ini file is being loaded. I suspect you are running websockets from the command line, and your php is initializing a different config file when in CLI mode.

like image 79
Werner Bihl Avatar answered Oct 14 '25 04:10

Werner Bihl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!