The solution to the problem that php.ini does not have extension: first check the php configuration in centOS; then add extension directly to php.ini.
The operating environment of this article: centOS6.8 system, php7.2 version, DELL G3 computer
Why does php.ini not have extension? manage?
Today I took a look at the php configuration in centOS
vim /etc/php.ini
I found that there is no extension=
configuration, even if there is, it is commented out
Execute php -i and find that
Loaded Configuration File => /etc/php.ini Scan this dir for additional .ini files => /etc/php.d Additional .ini files parsed => /etc/php.d/bz2.ini, /etc/php.d/calendar.ini, /etc/php.d/ctype.ini, /etc/php.d/curl.ini, /etc/php.d/dom.ini, /etc/php.d/exif.ini, /etc/php.d/fileinfo.ini, /etc/php.d/ftp.ini, /etc/php.d/gd.ini, /etc/php.d/gettext.ini, /etc/php.d/gmp.ini, /etc/php.d/iconv.ini, /etc/php.d/json.ini, /etc/php.d/mbstring.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/phar.ini, /etc/php.d/shmop.ini, /etc/php.d/simplexml.ini, /etc/php.d/sockets.ini, /etc/php.d/sqlite3.ini, /etc/php.d/tokenizer.ini, /etc/php.d/xml.ini, /etc/php.d/xml_wddx.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini, /etc/php.d/zip.ini
is originally loaded from /etc/php.d. When compiling php, add the parameter --with-config-file-scan-dir=/etc/php.d , because it is not compiled from the downloaded source code but directly installed php7.2, so this parameter should be carried by default.
So php will actively search for all ini configuration files in scan-dir other than php.ini.
Libraries that are supported during compilation are generally set to enable because they can be found in /etc/php.d. Without this parameter, Scan this dir for additional .ini files will be empty. Various libraries will not be automatically loaded, and you need to add them to php.ini yourself.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What to do if php.ini has no extension. For more information, please follow other related articles on the PHP Chinese website!