php -m did not find the extension because the configuration files of php-fpm mode and cli mode are inconsistent. The solution: first check the php installation location through which php command; then copy the php.ini file to the bin directory Just download it.
The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
php -m command cannot see the newly installed php extension, but there is ?
in phpinfo(). This situation is generally because the configuration files of php-fpm mode and cli mode are inconsistent. Use the command php -i | grep Loaded\ Configuration\ File It can be seen that the configuration file php.ini is not found in cli mode:
Solution:
Check the php installation location through the which php command:
[Recommended: PHP Video tutorial 】
Use the strace command to print the log:
strace /usr/local/bin/php -i 2>/phplog.log
Search the keyword php.ini in the log file and find the cli mode in this directory. php.ini file, but there is no php.ini in this directory:
What needs to be done is to copy the php.ini file to the next copy of this directory:
cp /etc/php.ini /usr/local/bin/php.ini
The above is the detailed content of What should I do if php -m does not find the extension?. For more information, please follow other related articles on the PHP Chinese website!