background

The client’s website needs to be deployed on the server. According to the current popular server, I chose to use the integrated installation package of LNMP. After the installation was completed, the code was deployed to the server. A Google search reveals that most people have a different problem than I do, but it turns out that there is no exif extension installed in PHP. Here’s how to install it.

View the extensions that are currently installed

Enter the following command on the server:

/usr/local/php/bin/php -m
Copy the code

View the installed modules, as shown in the following figure:

The LNMP installation package directory is displayed

1. cdLnmp1.3 - full / 2.cd src/
3. php -v Check the version of PHP you have installed, and then unzip the corresponding files
4. tar zxf php-7.0.7.tar.gz
5. cdPHP - 7.0.7 6.cd ext
Copy the code

As shown below:

The interface after step 6 is shown below, as shown below:

Go to the extension file directory

7. cd exif
8. /usr/local/php/bin/phpize
Copy the code

The execution result is shown as follows:

Compile and install

9.  ./configure --with-php-config=/usr/local/php/bin/php-config
10. make && make install
Copy the code

If the following figure is displayed, the installation is successful.

Introducing extended

The above extension has been installed successfully. Now we need to import the extension to the php.ini file by executing the following command:

11. vim /usr/local/php/etc/php.ini
12. Find the last extension and add the following code
    extension=exif.so
13. After saving, execute the restart command.
    /etc/init.d/php-fpm restart
Copy the code

Let’s check to see if the exif extension has been successfully installed, or use the command above to start viewing installed modules, as shown in the figure below:

Now when we upload the image on the server again, there will be no 500 error.