undefined constant AF_INET
mimmi20 opened this issue · comments
Monolog version 2.3.2
I'm trying to write factories for the handlers and got this error:
1) Mimmi20Test\LoggerFactory\Handler\SyslogUdpHandlerFactoryTest::testInvoceWithConfig
Use of undefined constant AF_INET - assumed 'AF_INET' (this will throw an Error in a future version of PHP)
C:\Users\Besitzer\Documents\GitHub\monolog-laminas-factory\vendor\monolog\monolog\src\Monolog\Handler\SyslogUdp\UdpSocket.php:32
C:\Users\Besitzer\Documents\GitHub\monolog-laminas-factory\vendor\monolog\monolog\src\Monolog\Handler\SyslogUdpHandler.php:62
C:\Users\Besitzer\Documents\GitHub\monolog-laminas-factory\src\Handler\SyslogUdpHandlerFactory.php:94
C:\Users\Besitzer\Documents\GitHub\monolog-laminas-factory\tests\Handler\SyslogUdpHandlerFactoryTest.php:88
Which extension is required to avoid this error?
the AF_INET
constant is part of the socket
extension of php.
please type this in your command line:php -m
You should get an output like this one:
[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets //<----------------------------------------------------------- do you see this?
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
oficial documentation about the socket extension: php documentation about sockets extension
I quote from sockets extension - insallation section
The socket functions described here are part of an extension to PHP which must be enabled at compile time by giving the --enable-sockets option to configure.
So please share the output of the command php -m
to make sure we are in the right path to solve this issue.
The sockets extension was missing on my system. Now is working.
@mimmi20 nice that it works now.
Can you please close the issue ?