Home  >  Article  >  Backend Development  >  linux - 为什么phpinfo里有mcrypt扩展,php -m里却没有

linux - 为什么phpinfo里有mcrypt扩展,php -m里却没有

WBOY
WBOYOriginal
2016-06-06 20:28:061194browse

为什么phpinfo里有mcrypt扩展,php -m里却没有

回复内容:

为什么phpinfo里有mcrypt扩展,php -m里却没有

PHP info 你是用网页查看的吧?
现在一般是用fpm的方式跑网页

php -m 是用cli跑的

也就是fpm 与 cli配置不同导致的。

手机码字不易。。。。

各种不同运行方式(SAPI),加载不同的ini文件。
在linux下,php的配置分下面几个apache,cli,cgi等。
你可以在cli运行时指定加载php.ini,这样就能得到你想要的结果了。
php -c /etc/php5/apache/php.ini -f test.php

PHP都是以调用SAPI方式运行,大家经常用的web网页是调用php-fpm,而用php -m 是调用 command line sapi,就是cli了,两者是不同的运行模式,前者用于网页请求,后者用于命令行.
两种模式有各自的配置文件,在 /etc/php5/fpm 和 /etc/php5/cli, 你会发现他们其实是大同小异的.
而且很多人用fpm的现象问cli的问题...

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