Home  >  Article  >  Backend Development  >  php -m is different from phpinfo() [memcache extension]

php -m is different from phpinfo() [memcache extension]

炎欲天舞
炎欲天舞Original
2017-08-21 10:17:273561browse

The cause of the incident is that openssl needs to be upgraded (openssl upgrade is not shown here), so php was also recompiled after the upgrade, and the compilation was successful.

Found that the memcache extension was not installed. I recompiled and installed it. The installation was successful, but phpinfo() did not display the memcache extension.

Found it, php.ini In the document, there is also a very strange problem with extension="memcache.so".

Look for the extension_dir directory in phpinfo(), and memcache.so also exists.

Restarting php-fpm does not work either After displaying (or apache or the like)

, you can use php -m to load memcache, but using phpinfo() there is no memcache


[root@x ~]# php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
ereg
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
memcache

It should be that php-cli and php-fpm call different configuration files of php.ini


[root@x ~]# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/php/etc
Loaded Configuration File => /usr/local/php/etc/php.ini

phpinfo.php This is a newly created php file. It says phpinfo()


[root@x ~]# curl http://127.0.0.1/phpinfo.php | grep php.ini

# 可以看到和上面的返回不一样

Create a symbolic link to /usr/local/php/lib


[root@x ~]# ln -s /usr/local/php/etc/php.ini /usr/local/php/lib/php.ini

PS: The above is edited later. What is shown may not be what happened at that time. The troubleshooting method is no problem. In addition, there are other troubleshooting methods for php memcache extension.

which php See if it is caused by multiple php versions, php -m and other issues

Are php-cli and php-fpm the same php version or php.ini (this happened Different php.ini)

php apache nginx memcache and other various restarts

by bin

The above is the detailed content of php -m is different from phpinfo() [memcache extension]. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn