Home >Backend Development >PHP Problem >How to install fileinfo extension in php

How to install fileinfo extension in php

王林
王林Original
2021-09-02 16:07:253929browse

How to install fileinfo extension in php: 1. Enter the php source file directory and execute [/usr/local/php/bin/phpize]; 2. Execute the [./configure --with-php] command; 3. Add the extension and restart the server.

How to install fileinfo extension in php

The operating environment of this article: centos 7, php 7.1, thinkpad t480 computer.

The following are the specific steps for how to install the fileinfo extension in PHP:

The first step is to find the directory of phpize, usually in the PHP directory you installed. Mine is in /usr/local/php/bin/phpize

The second step is to find the source file directory of the php you installed. I used oneinstack to install the php environment with one click; so I installed it in /home/package/oneinstack/ Unzip in the src/ directory

tar -zxvf  php-5.6.31.tar.gz

The third step Enter the php directory /ext/fileinfo/

The fourth step Execute /usr/local/php/bin/phpize will generate the configure file [reason Can be viewed]

Step 5 ./configure --with-php-config=/usr/local/php/bin/php-config [/usr/local/php/bin/ is your own php Directory】

Step 6

make && make install

Step 7 /usr/local/php/etc/php.ini Add extension: extension=fileinfo.so

Step 8 Restart nginx and php-fpm. At this time, fileinfo will also appear in the phpfinfo information

Recommended learning:php training

The above is the detailed content of How to install fileinfo extension in php. 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