Home > Backend Development > PHP Tutorial > How to install and open the PHP GD library under Linux

How to install and open the PHP GD library under Linux

WBOY
Release: 2016-07-25 08:55:13
Original
1833 people have browsed it
  1. # tar xvzf zlib-1.2.3.tar.gz
  2. # cd zlib-1.2.3
  3. # ./configure
  4. # make && make install
Copy the code

3. Install freetype

  1. # tar xvzf freetype-1.3.1.tar.gz
  2. # cd freetype-1.3.1
  3. # ./configure --prefix=/usr/local/freetype
  4. # make && make install
Copy the code

There are multiple lines of errors similar to: ftdump.c:172:1: error: pasting "." and "glyph_object" does not give a valid preprocessing token

Solution: Modify the code in test/ftdump.c: Change Print_Mem( memory_footprint.##field, string ) to: Print_Mem( memory_footprint.field, string ) Change #define FOOTPRINT( field ) Save_Memory( &memory_footprint.##field ) to: #define FOOTPRINT( field ) Save_Memory( &memory_footprint.field ) Remake && make install Or modify Makefile.in:

  1. 1. Remove all: tttest in ttlib tttest ttpo
  2. 2. Delete
  3. install:
  4. cd $(FTLIBDIR); $(MAKE) -f $(MAKEFILE) install
  5. cd $(FTTESTDIR); $ (MAKE) -f $(MAKEFILE) install
  6. cd $(FTPODIR); $(MAKE) install
  7. cd $(FTTESTDIR); $(MAKE) -f $(MAKEFILE) install
  8. # ./configure --prefix =/usr/local/freetype
  9. # make && make install
Copy code

4. Install libpng

  1. # tar xvzf libpng-1.5.2.tar.gz
  2. # cd libpng-1.5.2
  3. # ./configure --prefix=/usr/local/libpng
  4. # make && make install
Copy the code

5. Install jpegsrc

  1. # tar xvzf jpegsrc.v6b.tar.gz
  2. # cd jpegsrc.v6b
  3. # ./configure --prefix=/usr/local/jpeg6 –enable-shared –enable-static
  4. # make && make install
Copy code

Possible error: The prompt folder does not exist. It should be that the program cannot automatically create the folder. According to the error prompt, just create the file manually with mkdir. This time for example:

  1. # mkdir -p /usr/local/jpeg6/include/
  2. # mkdir -p /usr/local/jpeg6/lib/
  3. # mkdir -p /usr/local/jpeg6/bin/cjpeg
  4. # mkdir -p /usr/local/jpeg6/man/man1/
Copy the code

6. Install gettext (some have it directly, you can install the GD library first, report an error and then return to install it)

  1. # tar xvzf gettext-0.16.1.tar.gz
  2. # cd gettext-0.16.1
  3. # ./configure --prefix=/usr/local/gettext
  4. # make && make install
Copy the code

7. Install the GD library

  1. # tar xvzf gd-2.0.35.tar.gz
  2. # cd gd-2.0.35
  3. # ./configure --prefix=/usr/local/gd --with-jpeg=/usr/ local/jpeg6 --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype
  4. # make
  5. # make install
Copy code

configure...This step is possible Error: configure.ac:64: error: possibly undefined macro: AM_ICONV, you must install gettext (discussed in step 6)

8. Generate gd.so

  1. # cd ../php-5.2.17/ext/gd/
  2. #/usr/local/php5/bin/phpize
  3. #./configure --with-php-config=/usr/local /php5/bin/php-config --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd / --with-freetype-dir=/usr/local/freetype/
  4. # make && make install
Copy the code

At this time, at the end of make install, there will be the location where the gd library is stored, from that folder Copy gd.so to the extension library directory

9. Modify PHP.ini Add the following content to php.ini

  1. extension=gd.so
Copy the code

10. After the installation is completed, restart the Apache service

  1. # service httpd restart
Copy code


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