search
HomeBackend DevelopmentPHP ProblemHow to install php fileinfo extension

How to install php fileinfo extension

Sep 12, 2021 am 11:36 AM
phpfileinfo

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.

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool