Centos7 under PHP installation GD library centos7.2 CentOS 7.0 CentOS 6.7

Source: Internet
Author: User
CENTOS7 installation of PHP, or PHP's GD library support, are very simple.
Everything is done through Yum.
Yum Install PHP-GD
The above command to take care of PHP-GD support, quickly see if phpinfo support?

However, if you need to use different versions of PHP, that is quite a hassle, after groping, I found a more simple way.

Because you need to co-exist multiple PHP versions with the native version of the system, the version you require must be compiled with source code. (if there is any other way, please remember to inform me of the reply)

Well, compile PHP-GD support, most of the web is compiled FreeType, libpng, libjpeg ... Good complex, the author through one by one attempts, found or unsuccessful!!!! Later found that their own compiled GD library does not include JPEG and libpng support.
(By viewing the dependencies of the dynamic library files that you compiled LDD libgd.so.2)
Note: If you compile the source code by yourself, you successfully in the source version of PHP see the GD support PNG, then congratulations, you are too lucky.

Here's my approach:
Use the library of the system as much as possible, or a library where Yum sources can be installed, such as GD, Libpng, Libjpeg, Libfreetype ... Everything, the CentOS source is ready, we just want a different version of PHP. Since we need the source code to compile PHP, so we need to install the corresponding source version, and with the Devel logo version.

yum install libpng libpng-devel libjpeg-turbo libjpeg-turbo-devel freetype freetype-devel gd

In the PHP source directory: If there is an undefined gdxxx function error, you need to clean the results of the compilation.
Make clean
Re-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: Here we do not need to specify the specific GD, JPEG, PNG, FreeType directory location, directly adopt the System directory version (save time and effort OH).
After this installation, the GD library will follow OK, the new production of the Libphp5.so file has been installed in the specified Apache Moduls directory.

GD Support  Version  bundled (2.1.0 compatible)FreeType Support    enabledFreeType Linkage    Version2.4.11Read Support    enabledGIF Create Support  enabledJPEG Support    Version6Version1.5.13WBMP Support    enabledXBM Support enabled

Why can we save effort? The GD library that should be installed for CentOS has already connected the JPEG, PNG and other libraries. By LDd Liggd.so.2, you can prove that:
[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 <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the CENTOS7 under the PHP installation of the GD library, including the CENTOS7 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.