Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install the php fileinfo extension

Shulou Source: shulou.com Published: 2022-06-03 15:16:05 11月14日 Update

This article mainly explains "how to install php fileinfo extension". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to install php fileinfo extension".

This article operating environment: Centos7.6 system, PHP7.3 version, DELL G3 computer

How do I install the php fileinfo extension?

LNMP installs PHP fileinfo expansion module

Today on the server (Centos7.6) through the # composer install installation project Times error is as follows:

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.

Indicates that there is no php_fileinfo.dll module installed in my PHP environment.

The installation is as follows:

1. Find the PHP installation source directory (note that it is not the installation directory)

Many children's shoes may delete the original installation package after installing PHP, or the server is not deployed by itself and you don't know where to find it, it doesn't matter, query the version through PHP-V, and then download a new version of it.

I put mine in the / mydata/ directory

2 parsing the release of fileinfo module using phpize

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

# execute phpize command parsing (my PHP is installed on / 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 picture

# make

There is no error as follows

# make install

OK installed successfully and the generation path is "/ 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. You can detect which modules are installed in the current PHP through the # php-m command.

# just composer install again.

Thank you for reading, the above is the content of "how to install the php fileinfo extension", after the study of this article, I believe you have a deeper understanding of how to install the php fileinfo extension, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Modules learning content commands servers versions environments directories services success it doesn't matter one line again ideas situations files articles times more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB Apple Microsoft Huawei