Home  >  Article  >  Backend Development  >  How to install gd extension in PHP7

How to install gd extension in PHP7

藏色散人
藏色散人Original
2020-09-04 10:18:4210185browse

How to install the gd extension in php7: First install the gd extension through the "apt-get install php7.4-gd" command; then configure gd to the php configuration file "php.ini"; finally restart php, and Just check in phpinfo whether the installation is successful.

How to install gd extension in PHP7

Recommended: "PHP Video Tutorial"

Scenario ubuntu PHP version 7.4 Running server nginx

## 1. Update source

root@iZuf69urlacrut7qqxhcofZ:/web# sudo apt-get update

2. Installation gd extension

root@iZuf69urlacrut7qqxhcofZ:/web# apt-get install php7.4-gd

Wait for the installation to complete

cailongbiaoyuli
3. Configure gd to the php configuration file php.ini

3.1 First, we must find the path of the gd we installed. You can use find / -name gd.so to find the file

root@iZuf69urlacrut7qqxhcofZ:/web# find / -name gd.so

3.2 Configure the path from gd.so to php.ini
root@iZuf69urlacrut7qqxhcofZ:/web# vim /usr/local/php/etc/php.ini

Please refer to your server for the actual path. Open php.ini and add a line to the file.

extension = /usr/lib/php/20190902/gd.so

Please replace the path here according to the actual path found.

Edit and save.
4. Restart php

After restarting php, check whether the installation is successful in phpinfo.

Successful installation.

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