search

Home  >  Q&A  >  body text

How to solve the inconsistency between extensions in phpinfo and php -m under Mac?

I want to debug redis under mac. When compiling and installing phpredis, the phpize that comes with mac11.1 system has an error. So I upgraded php to 7.4.13 and then compiled and installed phpredis to 7.4.13. Now the problem is in the web page phpinfo. There is no redis extension, and the command php -m shows that redis is enabledQQ20210126-195429@2x.pngQQ20210126-195614@2x.png

癸亥王癸亥王1403 days ago1400

reply all(3)I'll reply

  • 癸亥王

    癸亥王2021-01-30 15:35:52

    The methods of the two teachers above were not successful. Finally, I installed nginx and solved it directly

    reply
    0
  • right-chen

    right-chen2021-01-27 10:18:02

    Mac comes with a PHP environment. Have you installed a new PHP environment? I see that the PHP addresses in the two pictures are different, one is under /usr/local/opt and the other is under /usr/local/etc. Maybe the redis you installed has been extended to the built-in PHP environment, and the web access is your newly installed PHP environment

    reply
    0
  • 灭绝师太

    灭绝师太2021-01-27 09:20:55

    The loaded configuration file in your phpinfo is /usr/local/etc/php/7.4/php.ini. Open this configuration file, reference redis in php.ini, add extension="redis.so", and then find The path of redis.so. After finding the path, change the reference path of redis.so in php.ini, for example: extension= '/usr/lib64/php/modules/redis.so', then restart php, systemctl restart php-fpm and then Restart apache, /bin/systemctl stop httpd.service/bin/systemctl start httpd.service and then check redis in the info file and it will start successfully~

    reply
    0
  • Cancelreply