I cannot connect to redis using php. I set up an environment with docker and tried to connect redis from php using php and redis containers, but it failed. I get the following error.
PHP Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib/php/20190902/redis.so (/ usr/lib/php/20190902/redis.so: undefined symbol: php_json_decode_ex), /usr/lib/php/20190902/redis.so.so (/usr/lib/php/20190902/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP Notice: session_start(): Redis not available while creating session_id in /var/www/html/index.php on line 2 PHP Warning: session_start(): Failed to read session data: redis (path: tcp://localhost:6379) in /var/www/html/index.php on line 2 string(0) "" save_handler=redis save_path=tcp://localhost:6379 session_id=
This is the php file that is executed in response to the error.
Part of the php.ini file.
[Session] ; Handler used to store/retrieve data. ; http://php.net/session.save-handler session.save_handler = redis session.save_path = "tcp://localhost:6379" ;verifying redis extension module extension=redis.so ; default redis timeout redis.timeout = 5
If I'm missing any information needed to resolve this issue, please let me know. Thank you in advance.
Attachment: I type ping and it returns pong. I can connect to redis from the php container using redis-cli. In addition, here is the path to redis.so. ~/usr/lib/php/20190902/redis.so
Path to php.ini (the server used is apache2). ~/etc/php/7.4/apache2/php.ini
Check if radish is working as a team
redis-cli ping
Answerpingpong
Make sure your PHP configuration contains the correct settings for the Redis extension. Check whether the
php.ini
file specifies the correct path toredis.so
and other necessary configurations.I have adjusted the Php.ini file as follows.
before fixing
adjusted
Thanks.