Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing GD Library by Centos php extension

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the method of installing GD library using Centos php extension". In daily operation, I believe that many people have doubts about the method of installing GD library by using Centos php extension. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "using Centos php extension to install GD library". Next, please follow the editor to study!

First of all, my PHP is compiled and installed by source code. You can see installing PHP and php-fpm by source code compilation.

First install the gd front library: freetype, jpegsrc,libpng.

1. Freetype

The code is as follows:

Wget "http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2"

Tar jxvf freetype-2.4.0.tar.bz2

Cd freetype-2.4.0

. / configure-- prefix=/usr/local/freetype & & make & & make install

2. Jpegsrc

The code is as follows:

Wget "http://www.ijg.org/files/jpegsrc.v9.tar.gz"

Tar zxvf jpegsrc.v9.tar.gz

Cd jpeg-9

CFLAGS= "- O3-fPIC". / configure-- prefix=/usr/local/jpeg & & make & & make install

Mkdir-p / usr/local/jpeg/include

Mkdir-p / usr/local/jpeg/lib

Mkdir-p / usr/local/jpeg/bin

Mkdir-p / usr/local/jpeg/man/man1

3. Libpng

The code is as follows:

Wget "http://downloads.sourceforge.net/project/libpng/libpng12/1.2.50/libpng-1.2.50.tar.gz?r=http%3A%2F%2Fwww.libpng.org%2Fpub%2Fpng%2Flibpng.html&ts=1376631135&use_mirror=nchc"

Tar zxvf libpng-1.2.50.tar.gz

Cd libpng-1.2.50

CFLAGS= "- O3-fPIC". / configure-- prefix=/usr/local/libpng & & make & & make install

Next you need to cd to the gd directory of the php source code, otherwise an error such as cannot find config.m4 will be reported.

The code is as follows:

Cd php-5.3.6

Cd ext

Cd gd

Then execute the command / usr/local/php/bin/phpize in this directory. When do I need to use phpize? When we need to add more modules and don't want to recompile php, we can use phpize. My PHP is installed in the / usr/local/php/ directory and can be modified according to individual circumstances.

The code is as follows:

/ usr/local/php/bin/phpize

You can now compile and install separately:

The code is as follows:

. / configure-with-php-configure=/usr/local/php/bin/php-config-with-jpeg-dir=/usr/local/jpeg-with-png-dir=/usr/local/libpng-with-freetype-dir=/usr/local/freetype

Or

. / 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

Then modify the php.ini file to add a line extension=gd.so under; extension=php_zip.dll

Restart Nginx and see if the installation is successful. Then execute / usr/local/php/bin/php-m to see if the gd module is loaded successfully.

The code is as follows:

Service nginx restart

/ usr/local/php/bin/php-m

Console lists:

The code is as follows:

[root@nowamagic gd] # / usr/local/php/bin/php-m

[PHP Modules]

Core

Ctype

Date

Dom

Ereg

Fileinfo

Filter

Gd

……

Gd is seen, which means that the gd library has been installed successfully.

Next, just restart php-fpm:

The code is as follows:

Killall php-fpm

/ usr/local/php/sbin/php-fpm

Phpinfo (), take a look.

OK, installed successfully.

At this point, the study on "how to install the GD library by Centos php extension" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report