PHP installation gd library under Centos7 centos7.2 centos 7.0 centos 6.7

WBOY
Release: 2016-07-29 08:54:22
Original
2333 people have browsed it

It is very simple to install php under Centos7, or php’s gd library support.
Everything is done through yum.
yum install php-gd
The above command will complete the support of php-gd. Quickly see if phpinfo supports it?

However, if you need to use different versions of php, it will be quite troublesome. After exploration, the author found a simpler way.

Since multiple php versions need to coexist with the system’s native version, the version you require must be compiled from source code. (If there are other ways, please remember to reply and let me know)

So, most of the support for compiling php-gd on the Internet is through compiling freetype, libpng, libjpeg... It's so complicated. After trying one by one, the author found that it still failed! ! ! ! Later I discovered that the gd library I compiled did not include support for jpeg and libpng.
(By checking the dependencies ldd libgd.so.2 of the dynamic library file compiled by yourself)
Note: If you successfully see that gd supports png in the source version of php by compiling the source code yourself, then congratulations, you are so lucky.

Here’s my method:
Use system libraries as much as possible, or libraries that can be installed from yum sources, such as gd, libpng, libjpeg, libfreetype... Everything, centos sources are ready, we just want a different version of php. Since we need source code to compile PHP, we need to install the corresponding source code version and the version with devel logo.

<code>yum install libpng libpng<span>-devel</span> libjpeg<span>-turbo</span> libjpeg<span>-turbo</span><span>-devel</span> freetype freetype<span>-devel</span> gd</code>
Copy after login

In the php source code directory: If an undefined gdXXX function error occurs, you need to clean the compiled results.
make clean
Make it again:
'./configure' '–with-mysql' '–with-apxs2=/usr/local/apache2/bin/apxs' '–with-curl' '–with-gd' '–with-jpeg-dir' '– with-png-dir' '–with-freetype-dir'
Note: We do not need to specify the specific location of the gd, jpeg, png, and freetype directories here. We directly use the version in the system directory (saving time and effort).
After this installation, the gd library is ok, and the newly produced libphp5.so file has been installed in the specified apache modules directory.

<code>
GD Support  enabled
GD <span>Version</span>  bundled (<span>2.1</span><span>.0</span> compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType <span>Version</span><span>2.4</span><span>.11</span>
GIF <span>Read</span> Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG <span>Version</span><span>6</span>b
PNG Support enabled
libPNG <span>Version</span><span>1.5</span><span>.13</span>
WBMP Support    enabled
XBM Support enabled</code>
Copy after login

Why can we save effort? It should be that the gd library installed on centos has already connected jpeg, png and other libraries. It can be proved through ldd liggd.so.2:
[root@iZ25mdbcou0Z ~]# ldd /usr/lib64/libgd.so.2
linux-vdso.so.1 => (0x00007fff591fe000)
libXpm.so.4 => /lib64/libXpm.so.4 (0x00007f91ed0c8000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f91ecd8a000)
libjpeg.so.62 => /lib64/libjpeg.so.62 (0x00007f91ecb34000)
libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f91ec8f8000)
libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f91ec652000)
libpng15.so.15 => /lib64/libpng15.so.15 (0x00007f91ec426000)
libz.so.1 => /lib64/libz.so.1 (0x00007f91ec210000)
libm.so.6 => /lib64/libm.so.6 (0x00007f91ebf0e000)
libc.so.6 => /lib64/libc.so.6 (0x00007f91ebb4c000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f91eb92b000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f91eb727000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f91eb4fc000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f91eb2e0000)
/lib64/ld-linux-x86-64.so.2 (0x00007f91ed52b000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f91eb0dc000)

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the installation of gd library for PHP under Centos7, including the content of centos7. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!