fennb/phirehose

Call to undefined function socket_last_error

Closed this issue · 4 comments

Today I got the following error... socket_last_error should be a php function, but it seems to be not available?! I am using docker (php:7-cli-alpine).

#3 {main}
  thrown in /www/vendor/fennb/phirehose/lib/Phirehose.php on line 522

Fatal error: Uncaught Error: Call to undefined function socket_last_error() in /www/vendor/fennb/phirehose/lib/Phirehose.php:522
Stack trace:
#0 /www/vendor/spatie/twitter-streaming-api/src/PhirehoseWrapper.php(56): Phirehose->consume()
#1 /www/vendor/spatie/twitter-streaming-api/src/BaseStream.php(37): Spatie\TwitterStreamingApi\PhirehoseWrapper->startListening()
#2 /www/music.php(70): Spatie\TwitterStreamingApi\BaseStream->startListening()
#3 {main}
  thrown in /www/vendor/fennb/phirehose/lib/Phirehose.php on line 522

You'll need to install (or enable) the Socket PHP extension: http://www.php.net/manual/en/sockets.installation.php

@ahmedofali: having installed the sockets extension, the error changes to

Uncaught Error: socket_last_error(): Argument #1 ($socket) must be of type ?Socket, resource given

@jonathantullett This occurs under PHP 8.0. I have created a PR that addresses this issue: #126

fennb commented

Solved as per #126.