How to install php fileinfo extension

藏色散人
Release: 2023-03-12 13:34:02
Original
6675 people have browsed it

How to install the php fileinfo extension: 1. Find the PHP installation source directory; 2. Parse and use phpize to release the fileinfo module; 3. Compile and install; 4. Restart PHP.

How to install php fileinfo extension

The operating environment of this article: Centos7.6 system, PHP7.3 version, DELL G3 computer

How to install the php fileinfo extension?

LNMP installs the PHP fileinfo extension module

Today, when installing the project on the server (Centos7.6) through # composer install, the following error occurred:

To enable extensions, verify that they are enabled in your .ini files:
     - /etc/php.ini
   You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Copy after login

It means that the php_fileinfo.dll module is not installed in my PHP environment.

Installation is as follows:

1. Find the PHP installation source directory (note that it is not the installation directory)
Many children's shoes may install the original installation after installing PHP. The package has been deleted, or the server was not deployed by itself and I don’t know where to find it. It doesn’t matter. Just query the version through PHP -V and then re-download the corresponding version.
Mine is placed in the /mydata/ directory

2 Parse and use phpize to release the fileinfo module

# cd /mydata/php-7.3.8/ext /fileinfo/

# Execute phpize command analysis (my PHP is installed in /usr/local/php)
# /usr/local/php/bin/phpize

3. Compile and install
# ./configure --with-php-config=/usr/local/php/bin/php-config
As shown in the figure

# make
No error is reported as follows,

# make install

OK The installation is successful and the path is generated For "/usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/"
4. Add to php.ini
# vim /etc/php.ini
Add extension=fileinfo.so to the last line of this file

Restart PHP # /etc/init.d/php-fpm restart
5. Pass # php -m The command can detect which modules are currently installed in PHP
How to install php fileinfo extension

# Just run composer install again.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install php fileinfo extension. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!