How to install gd extension in php
How to install gd extension in php: First open the PHP configuration file "php.ini"; then remove the semicolon in front of "extension=php_gd2.dll" in "php.ini".
Recommended: "PHP Video Tutorial"
Linux/windows system installation php-gd extension library
Yesterday, a customer asked me a question. When he used the Ranzhi OA system, he was prompted with the following error window when displaying pictures. Seeing this error message, we will definitely think that PHP's gd library is not installed, but this friend said that he used phpinfo to check the PHP environment and found that the gd extension already exists, and the problem still exists, so the headache is caused by the problem. where. The following is the screenshot this friend gave me:
Seeing this, some attentive friends may have discovered the problem. It is obvious that this user's gd extension is not completely installed. Here I will directly show you the screenshot after the complete installation of the gd library:
So we are checking the PHP environment to see if the extension is fully installed and complete. In response to the above problems, we will share this article with you. How to completely install the php-gd extension in linux/windows systems.
linux system article
1.CentOS system
About GD extension
gd extension is an open source image processing library. It provides a series of APIs for processing images, so that it can be used to create charts, graphics, thumbnails and other image processing operations. The gd extension supports common image formats such as JPG, PNG, and GIF, so before installing the php-gd extension, we need to install libpng, jpegsrc, and freetype. In the following installation steps, you can adjust the specific path settings according to your actual situation.
Install freetype
wget http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.5.5.tar.gz tar -xf freetype-2.5.5.tar.gz cd freetype-2.5.5 ./configure --prefix=/usr/local/freetype make && make install
Install jpegsrc
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz tar zxvf jpegsrc.v9.tar.gz cd jpeg-9 ./configure --prefix=/usr/local/jpeg make && make install
Install libpng
wget http://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.31/libpng-1.6.31.tar.gz tar zxvf libpng-1.6.31.tar.gz cd libpng-1.6.31 ./configure --prefix=/usr/local/libpng make && make install
Install GD extension
No longer recompile php, still use Add new extensions to phpize, be careful not to miss the make clean step.
cd /data/php-5.6.14/ext/gd/ make clean /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype make && make install
At this time, the gd.so file appears in the /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ directory.
Then modify the php.ini file and add a line
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/gd.so
Finally restart the service and check the php-gd extension information.
2.ubuntu system
sudo apt-get install php5-gd
Note that it is not php-gd but php5-gd.
Finally restart the service
windows article
Modify the PHP configuration file php.ini:
Place the php.ini collection extension=php_gd2.dll in front; just remove it.
Finally restart the service.
The above is the detailed content of How to install gd extension in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7
