Note: this article only applies if your current PHP version has been installed by yum. If you custom compiled it from source, this will not work.
Verify PHP as installed by yum
An easy task, using yum. First step, see if it's already installed.
[root@srv]# rpm -qa | grep php php-common-5.1.6-15.el5 php-cli-5.1.6-15.el5 php-5.1.6-15.el5 php-pdo-5.1.6-15.el5 php-mysql-5.1.6-15.el5
Install the GD library using yum
If the GD Library isn't present in that list, it wasn't installed on the server yet. Install it using yum.
[root@srv]# yum install php-gd Loading "installonlyn" plugin Setting up Install Process Setting up repositories extras 100% |====================| 1.1 kB 00:00 updates 100% |====================| 951 B 00:00 base 100% |====================| 1.1 kB 00:00 addons 100% |====================| 951 B 00:00 Reading repository metadata in from local files primary.xml.gz 100% |====================| 81 kB 00:00 ########################################## 282/282 primary.xml.gz 100% |====================| 164 kB 00:00 ########################################## 374/374 primary.xml.gz 100% |====================| 853 kB 00:00 ########################################## 2458/2458 Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for php-gd to pack into transaction set. php-gd-5.1.6-20.el5_2.1.i 100% |====================| 17 kB 00:00 ---> Package php-gd.i386 0:5.1.6-20.el5_2.1 set to be updated --> Running transaction check --> Processing Dependency: php-common = 5.1.6-20.el5_2.1 for package: php-gd --> Restarting Dependency Resolution with new changes. --> Populating transaction set with selected packages. Please wait. ---> Downloading header for php-common to pack into transaction set. php-common-5.1.6-20.el5_2 100% |====================| 21 kB 00:00 ---> Package php-common.i386 0:5.1.6-20.el5_2.1 set to be updated --> Running transaction check --> Processing Dependency: php-common = 5.1.6-15.el5 for package: php --> Processing Dependency: php-common = 5.1.6-15.el5 for package: php-pdo --> Processing Dependency: php-common = 5.1.6-15.el5 for package: php-mysql --> Processing Dependency: php-common = 5.1.6-15.el5 for package: php-cli --> Restarting Dependency Resolution with new changes. --> Populating transaction set with selected packages. Please wait. ---> Downloading header for php-pdo to pack into transaction set. php-pdo-5.1.6-20.el5_2.1. 100% |====================| 18 kB 00:00 ---> Package php-pdo.i386 0:5.1.6-20.el5_2.1 set to be updated ---> Downloading header for php-mysql to pack into transaction set. php-mysql-5.1.6-20.el5_2. 100% |====================| 18 kB 00:00 ---> Package php-mysql.i386 0:5.1.6-20.el5_2.1 set to be updated ---> Downloading header for php-cli to pack into transaction set. php-cli-5.1.6-20.el5_2.1. 100% |====================| 18 kB 00:00 ---> Package php-cli.i386 0:5.1.6-20.el5_2.1 set to be updated ---> Downloading header for php to pack into transaction set. php-5.1.6-20.el5_2.1.i386 100% |====================| 19 kB 00:00 ---> Package php.i386 0:5.1.6-20.el5_2.1 set to be updated --> Running transaction check Dependencies Resolved ================================= Package Arch Version Repository Size ================================= Installing: php-gd i386 5.1.6-20.el5_2.1 updates 113 k Updating for dependencies: php i386 5.1.6-20.el5_2.1 updates 1.1 M php-cli i386 5.1.6-20.el5_2.1 updates 2.1 M php-common i386 5.1.6-20.el5_2.1 updates 154 k php-mysql i386 5.1.6-20.el5_2.1 updates 84 k php-pdo i386 5.1.6-20.el5_2.1 updates 62 k Transaction Summary ================================= Install 1 Package(s) Update 5 Package(s) Remove 0 Package(s) Total download size: 3.7 M Is this ok [y/N]: y Downloading Packages: (1/6): php-pdo-5.1.6-20.e 100% |=========================| 62 kB 00:00 (2/6): php-common-5.1.6-2 100% |=========================| 154 kB 00:00 (3/6): php-gd-5.1.6-20.el 100% |=========================| 113 kB 00:00 (4/6): php-mysql-5.1.6-20 100% |=========================| 84 kB 00:00 (5/6): php-cli-5.1.6-20.e 100% |=========================| 2.1 MB 00:01 (6/6): php-5.1.6-20.el5_2 100% |=========================| 1.1 MB 00:00 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : php-common ####################### [ 1/11] Updating : php-pdo ####################### [ 2/11] Updating : php-cli ####################### [ 3/11] Installing: php-gd ####################### [ 4/11] Updating : php-mysql ####################### [ 5/11] Updating : php ####################### [ 6/11] Cleanup : php-pdo ####################### [ 7/11] Cleanup : php-common ####################### [ 8/11] Cleanup : php-mysql ####################### [ 9/11] Cleanup : php-cli ####################### [10/11] Cleanup : php ####################### [11/11] Installed: php-gd.i386 0:5.1.6-20.el5_2.1 Dependency Updated: php.i386 0:5.1.6-20.el5_2.1 php-cli.i386 0:5.1.6-20.el5_2.1 php-common.i386 0:5.1.6-20.el5_2.1 php-mysql.i386 0:5.1.6-20.el5_2.1 php-pdo.i386 0:5.1.6-20.el5_2.1 Complete!
Easy going, isn't it?
Restart Apache
Restart your apache, and you're ready to rock.
[root@srv]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
Simple as that!
Thanks for this info. It helped me a lot.
Regards,
That’s clear. But how do I setup yum repositories?
When I run “yum install php-gd”
it reports:
Parsing package install arguments
No package php-gd available.
Nothing to do
It does not find required packages.
Same problem here Buran!
Depending on the Linux Distro you’re using, this message can occur. You can try one of the following:
yum install php-gd.i386
yum install php5-gd
yum install php5-gd.i386
Another possibility is that anything related to php is excluded in the yum.conf. See if anything in the form of “php*” is present in that exclude list (yum.conf).
Depending on your current configuration (DirectAdmin/Plesk/CPanel/WHM) you need to find specific install-scripts related to your controlpanel. This sometimes requires a manual recompile of your PHP.
same problem,
i’m sorry, your comment still doesn’t work.
hi I manage to install using yum install gd all ok as below
============================================
root@server [~]# yum install gd
Loading “fastestmirror” plugin
Loading mirror speeds from cached hostfile
* base: http://ftp.cica.es
* updates: http://ftp.cica.es
* addons: http://ftp.cica.es
* extras: http://ftp.cica.es
Excluding Packages in global exclude list
Finished
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package gd.i386 0:2.0.33-9.4.el5_1.1 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
gd i386 2.0.33-9.4.el5_1.1 base 157 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 157 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): gd-2.0.33-9.4.el5_ 100% |=========================| 157 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: gd ######################### [1/1]
Installed: gd.i386 0:2.0.33-9.4.el5_1.1
Complete!
=========================================================
but when i go to check in phpinfo script i don’t see the Gd installed also i try to install PRESTASHOP witch require GD and it says GD not installed any help please
@Tunilove; it’s ‘yum install php-gd’.
You’ve just installed ‘gd’, and not ‘php-gd’. :-)
Thanks for the post, it was pretty simple to get GD installed for PHP5. No hassles and pretty quick.
Much appreciated!
Elemental
Excellent Post! You made that very clear. The one thing that I would like to add is that on some servers, if GD Library is not present, you may need to upload it to the server. A simple way to do this is
After you ssh into
your server, check to see if you have the wget or lynx available:
Use this command with wget–
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
or
lynx http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
and then hit D to download.
If not, download it to your local drive first and
then sftp it in.
After you get that .tar.gz to your server, do a
tar -pxvzf gd-2.0.11.tar.gz
to unpack it. Then
cd gd-2.0.11
Obrigado, este post alvou minha vida!!!
Abraços
Thanks for this tutorial. It helps a lot. Now my Function imagecreatefromjpeg is working.
William, I followed your instructions, got the package, unpacked it, and when I try again : yum install php-gd
I still get :
root@server123 [~/gd-2.0.11]# yum install php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: http://ftp.plusline.de
* base: http://ftp.plusline.de
* extras: http://ftp.plusline.de
* updates: http://ftp.plusline.de
Excluding Packages in global exclude list
Finished
Setting up Install Process
No package php-gd available.
Nothing to do
Marc, William, same here. After
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
After you get that .tar.gz to your server, do a
tar -pxvzf gd-2.0.11.tar.gz
to unpack it. Then
cd gd-2.0.11
then
root@server2 [~/gd-2.0.11]# yum install php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirrors.netdna.com
* base: mirror.raystedman.net
* extras: mirrors.tummy.com
* updates: mirrors.netdna.com
Excluding Packages in global exclude list
Finished
Setting up Install Process
No package php-gd available.
Nothing to do
root@server2 [~/gd-2.0.11]#
@Marc, @Scorch;
When GD is downloaded, go into the directory where it’s extracted, and type:
./configure
./make
./make install
What you’ve downloaded is the source package, which needs to be configured (./configure), compiled (./make) and installed (./make install).
./configure
Yielded results.
./make
./make install
Did not yield any results. Is more information required?
Mike, did you run this with root privileges? Either use “sudo make” and “sudo make install” or make sure to log in as root.
Hi,
how can i Do it?
./configure
./make
./make install
thank’s
I appreciate your feedback. I am logging on as root. The following represents what messages we get back from the process. Any help will be appreciated.
login as: root
root@beaufurn.com‘s password:
Last login: Thu Jul 15 22:31:35 2010 from cpe-065-188-189-189.triad.res.rr.com
root@svr1 [~]# cd gd-2.0.11
root@svr1 [~/gd-2.0.11]# ./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking for gcc… gcc
checking for C compiler default output… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ANSI C… none needed
checking for style of include used by make… GNU
checking dependency style of gcc… gcc3
checking for gcc option to accept ANSI C… none needed
checking for a BSD-compatible install… /usr/bin/install -c
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking for ld used by GCC… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for /usr/bin/ld option to reload object files… -r
checking for BSD-compatible nm… /usr/bin/nm -B
checking for a sed that does not truncate output… /bin/sed
checking whether ln -s works… yes
checking how to recognise dependent libraries… pass_all
checking command to parse /usr/bin/nm -B output… ok
checking how to run the C preprocessor… gcc -E
checking for egrep… grep -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking dlfcn.h usability… yes
checking dlfcn.h presence… yes
checking for dlfcn.h… yes
checking for ranlib… ranlib
checking for strip… strip
checking for objdir… .libs
checking for gcc option to produce PIC… -fPIC
checking if gcc PIC flag -fPIC works… yes
checking if gcc static flag -static works… yes
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.lo… yes
checking if gcc supports -fno-rtti -fno-exceptions… yes
checking whether the linker (/usr/bin/ld) supports shared libraries… yes
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking dynamic linker characteristics… GNU/Linux ld.so
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking whether -lc should be explicitly linked in… no
creating libtool
checking whether ln -s works… yes
checking whether make sets $(MAKE)… (cached) yes
checking for ranlib… (cached) ranlib
checking for X… no
checking for ANSI C header files… (cached) yes
checking errno.h usability… yes
checking errno.h presence… yes
checking for errno.h… yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking stddef.h usability… yes
checking stddef.h presence… yes
checking for stddef.h… yes
checking for stdlib.h… (cached) yes
checking for string.h… (cached) yes
checking for unistd.h… (cached) yes
checking for ld used by GCC… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for shared library run path origin… done
checking for iconv… yes
checking for iconv declaration…
extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking iconv.h usability… yes
checking iconv.h presence… yes
checking for iconv.h… yes
checking whether iconv.h defines iconv_t… yes
checking for deflate in -lz… yes
checking for libpng-config… /usr/bin/libpng-config
checking png.h usability… yes
checking png.h presence… yes
checking for png.h… yes
checking for png_create_read_struct in -lpng… yes
checking for freetype-config… /usr/bin/freetype-config
checking for FT_Init_FreeType in -lfreetype… yes
checking freetype/freetype.h usability… no
checking freetype/freetype.h presence… no
checking for freetype/freetype.h… no
checking for jpeg_set_defaults in -ljpeg… yes
checking for XpmReadFileToXpmImage in -lXpm… yes
** Configuration summary for gd 2.0.11:
Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Xpm library: yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config/gdlib-config
config.status: creating test/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
root@svr1 [~/gd-2.0.11]# ./make
-bash: ./make: No such file or directory
root@svr1 [~/gd-2.0.11]# ./make install
-bash: ./make: No such file or directory
root@svr1 [~/gd-2.0.11]# make
make all-recursive
make[1]: Entering directory `/root/gd-2.0.11′
Making all in config
make[2]: Entering directory `/root/gd-2.0.11/config’
make[2]: Nothing to be done for `all’.
make[2]: Leaving directory `/root/gd-2.0.11/config’
Making all in test
make[2]: Entering directory `/root/gd-2.0.11/test’
make[2]: Nothing to be done for `all’.
make[2]: Leaving directory `/root/gd-2.0.11/test’
make[2]: Entering directory `/root/gd-2.0.11′
if /bin/sh ./libtool –mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF “.deps/gdft.Tpo” \
-c -o gdft.lo `test -f ‘gdft.c’ || echo ‘./’`gdft.c; \
then mv “.deps/gdft.Tpo” “.deps/gdft.Plo”; \
else rm -f “.deps/gdft.Tpo”; exit 1; \
fi
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF .deps/gdft.Tpo -c gdft.c -fPIC -DPIC -o .libs/gdft.lo
In file included from gdft.c:56:
/usr/include/freetype2/freetype/freetype.h:20:2: error: #error “`ft2build.h’ hasn’t been included yet!”
/usr/include/freetype2/freetype/freetype.h:21:2: error: #error “Please always use macros to include FreeType header files.”
/usr/include/freetype2/freetype/freetype.h:22:2: error: #error “Example:”
/usr/include/freetype2/freetype/freetype.h:23:2: error: #error ” #include ”
/usr/include/freetype2/freetype/freetype.h:24:2: error: #error ” #include FT_FREETYPE_H”
make[2]: *** [gdft.lo] Error 1
make[2]: Leaving directory `/root/gd-2.0.11′
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/gd-2.0.11′
make: *** [all] Error 2
root@svr1 [~/gd-2.0.11]# make install
Making install in config
make[1]: Entering directory `/root/gd-2.0.11/config’
make[2]: Entering directory `/root/gd-2.0.11/config’
/bin/sh ../config/mkinstalldirs /usr/local/bin
/usr/bin/install -c gdlib-config /usr/local/bin/gdlib-config
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/root/gd-2.0.11/config’
make[1]: Leaving directory `/root/gd-2.0.11/config’
Making install in test
make[1]: Entering directory `/root/gd-2.0.11/test’
make[2]: Entering directory `/root/gd-2.0.11/test’
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/root/gd-2.0.11/test’
make[1]: Leaving directory `/root/gd-2.0.11/test’
make[1]: Entering directory `/root/gd-2.0.11′
if /bin/sh ./libtool –mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF “.deps/gdft.Tpo” \
-c -o gdft.lo `test -f ‘gdft.c’ || echo ‘./’`gdft.c; \
then mv “.deps/gdft.Tpo” “.deps/gdft.Plo”; \
else rm -f “.deps/gdft.Tpo”; exit 1; \
fi
rm -f .libs/gdft.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF .deps/gdft.Tpo -c gdft.c -fPIC -DPIC -o .libs/gdft.lo
In file included from gdft.c:56:
/usr/include/freetype2/freetype/freetype.h:20:2: error: #error “`ft2build.h’ hasn’t been included yet!”
/usr/include/freetype2/freetype/freetype.h:21:2: error: #error “Please always use macros to include FreeType header files.”
/usr/include/freetype2/freetype/freetype.h:22:2: error: #error “Example:”
/usr/include/freetype2/freetype/freetype.h:23:2: error: #error ” #include ”
/usr/include/freetype2/freetype/freetype.h:24:2: error: #error ” #include FT_FREETYPE_H”
make[1]: *** [gdft.lo] Error 1
make[1]: Leaving directory `/root/gd-2.0.11′
make: *** [install-recursive] Error 1
root@svr1 [~/gd-2.0.11]#
Your problem lies here:
In file included from gdft.c:56:
/usr/include/freetype2/freetype/freetype.h:20:2: error: #error “`ft2build.h’ hasn’t been included yet!”
/usr/include/freetype2/freetype/freetype.h:21:2: error: #error “Please always use macros to include FreeType header files.”
/usr/include/freetype2/freetype/freetype.h:22:2: error: #error “Example:”
/usr/include/freetype2/freetype/freetype.h:23:2: error: #error ” #include ”
/usr/include/freetype2/freetype/freetype.h:24:2: error: #error ” #include FT_FREETYPE_H”
make[2]: *** [gdft.lo] Error 1
make[2]: Leaving directory `/root/gd-2.0.11′
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/gd-2.0.11′
make: *** [all] Error 2
What operating system are you running on? Latest version of CentOS 5?
There are several solutions posted in relation to freetype: http://bit.ly/djNOvE
OS = CENTOS 5.5
Thnx
For lastes PHP Version, just use CentOS-Testing.repo
[c5-testing]
name=CentOS-5 Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
Then $ yum update
Regards,
Eric
GREAT JOB! Awesome tutorial. :)
Thanks
I have a dependency mismatch(?) issue :-|
root@devel-qa:/home/johnny# yum install php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: http://ftp.dei.uc.pt
* base: centos.cict.fr
* extras: http://ftp.dei.uc.pt
* updates: mirror.ovh.net
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package php-gd.x86_64 0:5.1.6-27.el5_5.3 set to be updated
–> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-gd
–> Finished Dependency Resolution
php-gd-5.1.6-27.el5_5.3.x86_64 from updates has depsolving problems
–> Missing Dependency: php-common = 5.1.6-27.el5_5.3 is needed by package php-gd-5.1.6-27.el5_5.3.x86_64 (updates)
Error: Missing Dependency: php-common = 5.1.6-27.el5_5.3 is needed by package php-gd-5.1.6-27.el5_5.3.x86_64 (updates)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest
The program package-cleanup is found in the yum-utils package.
but… yum install php-common = 5.1.6-27.el5_5.3
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: http://ftp.dei.uc.pt
* base: centos.cict.fr
* extras: http://ftp.dei.uc.pt
* updates: mirror.ovh.net
Setting up Install Process
Package matching php-common-5.1.6-27.el5_5.3.x86_64 already installed. Checking for update.
No package = available.
No package 5.1.6-27.el5_5.3 available.
Nothing to do
# rpm -qa | grep php
php-pdo-5.2.16-jason.1
php-snmp-5.2.16-jason.1
php-dba-5.2.16-jason.1
php-common-5.2.16-jason.1
php-cli-5.2.16-jason.1
php-5.2.16-jason.1
php-mysql-5.2.16-jason.1
php-ldap-5.2.16-jason.1
any help would be appreciated
It’s trying to install “php-gd-5.1.6″ on a “php-common-5.2.16″ system. So 5.1.6 libraries for a PHP 5.2.16.
Please try:
# yum clean all
# yum update
# yum install php-gd
If that does not work, disable all yum repositories in /etc/yum.repos.d/* and only enable the one from “jason” (where your current packages come from).
Thanks,
A very simple and clear document.
here is my log
In file included from gdft.c:56:
/usr/include/freetype2/freetype/freetype.h:20:2: error: #error “`ft2build.h’ hasn’t been included yet!”
/usr/include/freetype2/freetype/freetype.h:21:2: error: #error “Please always use macros to include FreeType header files.”
/usr/include/freetype2/freetype/freetype.h:22:2: error: #error “Example:”
/usr/include/freetype2/freetype/freetype.h:23:2: error: #error ” #include ”
/usr/include/freetype2/freetype/freetype.h:24:2: error: #error ” #include FT_FREETYPE_H”
make[2]: *** [gdft.lo] Error 1
make[2]: Leaving directory `/root/gd-2.0.11′
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/gd-2.0.11′
make: *** [all] Error 2
root@server2 [~/gd-2.0.11]# sudo make install
Making install in config
make[1]: Entering directory `/root/gd-2.0.11/config’
make[2]: Entering directory `/root/gd-2.0.11/config’
/bin/sh ../config/mkinstalldirs /usr/local/bin
/usr/bin/install -c gdlib-config /usr/local/bin/gdlib-config
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/root/gd-2.0.11/config’
make[1]: Leaving directory `/root/gd-2.0.11/config’
Making install in test
make[1]: Entering directory `/root/gd-2.0.11/test’
make[2]: Entering directory `/root/gd-2.0.11/test’
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/root/gd-2.0.11/test’
make[1]: Leaving directory `/root/gd-2.0.11/test’
make[1]: Entering directory `/root/gd-2.0.11′
if /bin/sh ./libtool –mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF “.deps/gdft.Tpo” \
-c -o gdft.lo `test -f ‘gdft.c’ || echo ‘./’`gdft.c; \
then mv “.deps/gdft.Tpo” “.deps/gdft.Plo”; \
else rm -f “.deps/gdft.Tpo”; exit 1; \
fi
rm -f .libs/gdft.lo
gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT gdft.lo -MD -MP -MF .deps/gdft.Tpo -c gdft.c -fPIC -DPIC -o .libs/gdft.lo
In file included from gdft.c:56:
/usr/include/freetype2/freetype/freetype.h:20:2: error: #error “`ft2build.h’ hasn’t been included yet!”
/usr/include/freetype2/freetype/freetype.h:21:2: error: #error “Please always use macros to include FreeType header files.”
/usr/include/freetype2/freetype/freetype.h:22:2: error: #error “Example:”
/usr/include/freetype2/freetype/freetype.h:23:2: error: #error ” #include ”
/usr/include/freetype2/freetype/freetype.h:24:2: error: #error ” #include FT_FREETYPE_H”
make[1]: *** [gdft.lo] Error 1
make[1]: Leaving directory `/root/gd-2.0.11′
make: *** [install-recursive] Error 1
You’re compiling GD from source, the article shows you how to do so via yum/rpm packages.
Seems like you’re missing recent freetype development packages. Either try to install the “freetype-devel” package or download the latest source and refer to it in your configure command.
Muchas gracias, me funciono de maravellas
;)
The best way if you are using Centos and have root access is to follow this:
/scripts/easyapache
Then start looking for the list and you will see GD
select it and build
service httpd restart
/etc/init.d/httpd restart
Checl your PHP configuration and that’s it, you will see GD installed.
Thanks, Muchas Gracias
I have done as told but still in my phpinfo() file it is not showing the GD library ? Anyone have any idea ?
[root@survey ~]# yum install php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.aol.in
* base: centos.aol.in
* extras: centos.aol.in
* updates: centos.aol.in
Setting up Install Process
Package php-gd-5.2.10-1.el5.centos.x86_64 already installed and latest version
Nothing to do
It seems like php-gd is installed but php is not picking it up
Did you restart the Apache webservice after your installation? What does the following give you as output:
# php -i | grep -i GD
Configure Command => ‘./configure’ ‘–build=i386-redhat-linux-gnu’ ‘–host=i386-redhat-linux-gnu’ ‘–program-prefix=’ ‘–disable-dependency-tracking’ ‘–prefix=/usr’ ‘–exec-prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’ ‘–sysconfdir=/etc’ ‘–datadir=/usr/share’ ‘–includedir=/usr/include’ ‘–libdir=/usr/lib’ ‘–libexecdir=/usr/libexec’ ‘–localstatedir=/var’ ‘–sharedstatedir=/var/lib’ ‘–mandir=/usr/share/man’ ‘–infodir=/usr/share/info’ ‘–cache-file=../config.cache’ ‘–with-libdir=lib’ ‘–with-config-file-path=/etc’ ‘–with-config-file-scan-dir=/etc/php.d’ ‘–disable-debug’ ‘–with-pic’ ‘–disable-rpath’ ‘–without-pear’ ‘–with-bz2′ ‘–with-exec-dir=/usr/bin’ ‘–with-freetype-dir=/usr’ ‘–with-png-dir=/usr’ ‘–with-xpm-dir=/usr’ ‘–enable-gd-native-ttf’ ‘–with-t1lib=/usr’ ‘–without-gdbm’ ‘–with-gettext’ ‘–with-gmp’ ‘–with-iconv’ ‘–with-jpeg-dir=/usr’ ‘–with-openssl’ ‘–with-pcre-regex=/usr’ ‘–with-zlib’ ‘–with-layout=GNU’ ‘–enable-exif’ ‘–enable-ftp’ ‘–enable-magic-quotes’ ‘–enable-sockets’ ‘–with-kerberos’ ‘–enable-ucd-snmp-hack’ ‘–enable-shmop’ ‘–enable-calendar’ ‘–without-sqlite’ ‘–with-libxml-dir=/usr’ ‘–enable-xml’ ‘–with-system-tzdata’ ‘–with-mhash’ ‘–enable-force-cgi-redirect’ ‘–libdir=/usr/lib/php’ ‘–enable-pcntl’ ‘–with-imap=shared’ ‘–with-imap-ssl’ ‘–enable-mbstring=shared’ ‘–enable-mbregex’ ‘–with-gd=shared’ ‘–enable-bcmath=shared’ ‘–enable-dba=shared’ ‘–with-db4=/usr’ ‘–with-xmlrpc=shared’ ‘–with-ldap=shared’ ‘–with-ldap-sasl’ ‘–enable-mysqlnd=shared’ ‘–with-mysql=shared,mysqlnd’ ‘–with-mysqli=shared,mysqlnd’ ‘–with-interbase=shared,/usr/lib/firebird’ ‘–with-pdo-firebird=shared,/usr/lib/firebird’ ‘–enable-dom=shared’ ‘–with-pgsql=shared’ ‘–enable-wddx=shared’ ‘–with-snmp=shared,/usr’ ‘–enable-soap=shared’ ‘–with-xsl=shared,/usr’ ‘–enable-xmlreader=shared’ ‘–enable-xmlwriter=shared’ ‘–with-curl=shared,/usr’ ‘–enable-fastcgi’ ‘–enable-pdo=shared’ ‘–with-pdo-odbc=shared,unixODBC,/usr’ ‘–with-pdo-mysql=shared,mysqlnd’ ‘–with-pdo-pgsql=shared,/usr’ ‘–with-pdo-sqlite=shared,/usr’ ‘–with-pdo-dblib=shared,/usr’ ‘–with-sqlite3=shared,/usr’ ‘–enable-json=shared’ ‘–without-readline’ ‘–with-libedit’ ‘–with-pspell=shared’ ‘–enable-phar=shared’ ‘–with-mcrypt=shared,/usr’ ‘–with-tidy=shared,/usr’ ‘–with-mssql=shared,/usr’ ‘–enable-sysvmsg=shared’ ‘–enable-sysvshm=shared’ ‘–enable-sysvsem=shared’ ‘–enable-posix=shared’ ‘–with-unixODBC=shared,/usr’ ‘–enable-fileinfo=shared’ ‘–enable-intl=shared’ ‘–with-icu-dir=/usr’ ‘–with-enchant=shared,/usr’ ‘–with-recode=shared,/usr’
/etc/php.d/gd.ini,
PHP Warning: Unknown: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Calcutta’ for ‘IST/5.0/no DST’ instead in Unknown on line 0
gd
GD Support => enabled
GD Version => bundled (2.0.34 compatible)
gd.jpeg_ignore_warning => 0 => 0
how can i do ./configure, make & install, Please help?
It looks like you’ve already got gd, why would you re-compile with configure & make?
Dude. Thank you.
Banging my head against a wall for two hours, trying to get thumbnails working for my WordPress site. Then I stumble across your site and everything is fixed in under a minute. Thank you so much! Fyi for anyone else that goes through this frustration – “rpm -qa | grep gd” does NOT show whether you have the GD libraries installed. You gotta grep for php-gd. Argh!!
Actually, the “grep gd” should work as well, as the term “gd” is part of the package “php-gd”.
Awesome. Thank you. Been searching for hours.
extra info to Marco’s message(about /scripts/easyapache):
if you have cPanel/WHM (enter under root user):
Go to menu “Software”->”EasyApache(Apache Update)”
set [*] PHP Image Manipulation
[Build Profile Now]
I have tried “yum” and “make install” on CentOS 5.5, but only recompilation PHP by EasyApache helps me (PHP Image Manipulation) profile.
thanks….
I tried to install using following command not able to install GD also tried with WHM >> Easy apache & WHMXtra option :(
yum install php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: http://ftp.plusline.de
* extras: http://ftp.plusline.de
* updates: http://ftp.plusline.de
Setting up Install Process
No package php-gd available.
Error: Nothing to do
I used command # php -i | grep -i GD
gave me following result
OLDPWD => /root/gd-2.0.11
_SERVER["OLDPWD"] => /root/gd-2.0.11
_ENV["OLDPWD"] => /root/gd-2.0.11
I am using Cent os 6.2 :(
Hi Nick,
This is the problem: “No package php-gd available.”
Do a “yum search php*” and see if anything matches “gd”?
I need to install GD and Free Type on to my server to use contact form 7 plugin on WP (for the captcha service)
I have installed from the root as such
# gd gd-devel php-gd
after it loaded I then ran
/etc/init.d/httpd restart
however I can’t see that it has loaded, so I asked my server support who responded with the following
I notice when trying to install GD it looks like there are some dependencies missing:
Resolving Dependencies
–> Running transaction check
—> Package php-gd.i386 0:5.1.6-27.el5_7.4 set to be updated
–> Processing Dependency: php-common = 5.1.6-27.el5_7.4 for package: php-gd
–> Finished Dependency Resolution
php-gd-5.1.6-27.el5_7.4.i386 from updates has depsolving problems
–> Missing Dependency: php-common = 5.1.6-27.el5_7.4 is needed by package php-gd-5.1.6-27.el5_7.4.i386 (updates)
Error: Missing Dependency: php-common = 5.1.6-27.el5_7.4 is needed by package php-gd-5.1.6-27.el5_7.4.i386 (updates)
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest
You may need to install any of these before getting GD to install. Once those are installed give it another try and see if it will complete.
I’ve done a search, but can’t find out how I to add these other missing dependencies? can anyone suggest How I might do this?
cheers!
You could try:
and then retry your “yum install php-gd”.
If that also doesn’t work, consider a full system update:
but be careful with that, you may end up upgrading your PHP 5.1 install to a 5.2 or 5.3 install (depending on the repositories you have) and end up hurting yourself even more.
yum search php*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.cogentco.com
* extras: mirror.ash.fastserv.com
* updates: mirror.us.leaseweb.net
Excluding Packages in global exclude list
Finished
Warning: No matches found for: php*
No Matches found
root@www [~]#
Best guess: check the /etc/yum.conf and /etc/yum.repos.d/*.conf files for an “exclude=” parameter that includes the php packages.
There is a line in yum.conf which reads like “exclude= apache* ruby* php* perl* …”
Wonder why most of the languages excluded like that.
I removed “php*” and “yum install php-gd” worked as expected.
Thanks!
Thanks, after remove php* from yum.conf I installing php-gd but when I go to check phpinfo I don’t see the Gd installed, so I did what marcos, I configure php for image manipulation and it worked =D
hi, after downloading gd-2.0.11 i followed what you said but the results after ./configure is this:
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking for gcc… no
checking for cc… no
checking for cc… no
checking for cl… no
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details.
would you know the problem with this? Thanks!
do: “yum install gcc make autoconf”
You’re missing the gcc compiler.
Thanks! i got gcc then i went to gd-2.0.11 and did ./configure. this is the result:
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking for gcc… gcc
checking for C compiler default output… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ANSI C… none needed
checking for style of include used by make… GNU
checking dependency style of gcc… gcc3
checking for gcc option to accept ANSI C… none needed
checking for a BSD-compatible install… /usr/bin/install -c
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
checking for ld used by GCC… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for /usr/bin/ld option to reload object files… -r
checking for BSD-compatible nm… /usr/bin/nm -B
checking for a sed that does not truncate output… /bin/sed
checking whether ln -s works… yes
checking how to recognise dependent libraries… file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )
checking command to parse /usr/bin/nm -B output… ok
checking how to run the C preprocessor… gcc -E
checking for egrep… grep -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking dlfcn.h usability… yes
checking dlfcn.h presence… yes
checking for dlfcn.h… yes
checking for file… /usr/bin/file
checking for ranlib… ranlib
checking for strip… strip
checking for objdir… .libs
checking for gcc option to produce PIC… -fPIC
checking if gcc PIC flag -fPIC works… yes
checking if gcc static flag -static works… yes
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.lo… yes
checking if gcc supports -fno-rtti -fno-exceptions… yes
checking whether the linker (/usr/bin/ld) supports shared libraries… yes
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking dynamic linker characteristics… GNU/Linux ld.so
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking whether -lc should be explicitly linked in… no
creating libtool
checking whether ln -s works… yes
checking whether make sets $(MAKE)… (cached) yes
checking for ranlib… (cached) ranlib
checking for X… no
checking for ANSI C header files… (cached) yes
checking errno.h usability… yes
checking errno.h presence… yes
checking for errno.h… yes
checking limits.h usability… yes
checking limits.h presence… yes
checking for limits.h… yes
checking stddef.h usability… yes
checking stddef.h presence… yes
checking for stddef.h… yes
checking for stdlib.h… (cached) yes
checking for string.h… (cached) yes
checking for unistd.h… (cached) yes
checking for ld used by GCC… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for shared library run path origin… done
checking for iconv… yes
checking for iconv declaration…
extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking iconv.h usability… yes
checking iconv.h presence… yes
checking for iconv.h… yes
checking whether iconv.h defines iconv_t… yes
checking for deflate in -lz… no
configure: WARNING: zlib is required – see http://www.gzip.org/zlib/
checking for libpng-config… no
checking png.h usability… no
checking png.h presence… no
checking for png.h… no
checking libpng/png.h usability… no
checking libpng/png.h presence… no
checking for libpng/png.h… no
checking for png_create_read_struct in -lpng… no
configure: WARNING: libpng is required – see http://www.libpng.org/pub/png/
checking for freetype-config… no
checking for FT_Init_FreeType in -lfreetype… no
configure: WARNING: not found – disabling freetype support
checking freetype/freetype.h usability… no
checking freetype/freetype.h presence… no
checking for freetype/freetype.h… no
checking for jpeg_set_defaults in -ljpeg… no
checking for XpmReadFileToXpmImage in -lXpm… no
** Configuration summary for gd 2.0.11:
Support for PNG library: no
Support for JPEG library: no
Support for Freetype 2.x library: no
Support for Xpm library: no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating config/gdlib-config
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands
**I don’t know what that means so i proceed to ./make and also tried ./make install but both resulted to:
-bash: ./make: No such file or directory
I also found someone said that this would install gd in cent OS in one step: yum install gd gd-devel php-gd
is it true?
Yes, provided you have your current PHP stack also installed via yum. Read the article again from top to bottom, it’s explained in fine detail in there.
after i tried yum install gd gd-devel php-gd this is the result:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.ash.fastserv.com
* extras: mirror.sanctuaryhost.com
* updates: mirrors.liquidweb.com
base | 1.1 kB 00:00
extras | 2.1 kB 00:00
updates | 1.9 kB 00:00
Setting up Install Process
No package gd-level available.
Resolving Dependencies
–> Running transaction check
—> Package gd.i386 0:2.0.33-9.4.el5_4.2 set to be updated
–> Processing Dependency: pkgconfig for package: gd
–> Processing Dependency: libXpm.so.4 for package: gd
—> Package gd.x86_64 0:2.0.33-9.4.el5_4.2 set to be updated
–> Processing Dependency: libXpm.so.4()(64bit) for package: gd
—> Package php-gd.x86_64 0:5.1.6-32.el5 set to be updated
–> Processing Dependency: php-common = 5.1.6-32.el5 for package: php-gd
–> Running transaction check
—> Package libXpm.i386 0:3.5.5-3 set to be updated
—> Package libXpm.x86_64 0:3.5.5-3 set to be updated
—> Package php-common.x86_64 0:5.1.6-32.el5 set to be updated
—> Package pkgconfig.x86_64 1:0.21-2.el5 set to be updated
–> Processing Conflict: php53-common conflicts php-common
–> Restarting Dependency Resolution with new changes.
–> Running transaction check
–> Processing Dependency: php53-common = 5.3.3-1.el5_6.1 for package: php53
–> Processing Dependency: php53-common = 5.3.3-1.el5_6.1 for package: php53-cli
–> Processing Dependency: php53-common = 5.3.3-1.el5_6.1 for package: php53-pdo
–> Processing Dependency: php53-common = 5.3.3-1.el5_6.1 for package: php53-mysql
—> Package php53-common.x86_64 0:5.3.3-5.el5 set to be updated
–> Running transaction check
—> Package php53.x86_64 0:5.3.3-5.el5 set to be updated
—> Package php53-cli.x86_64 0:5.3.3-5.el5 set to be updated
—> Package php53-mysql.x86_64 0:5.3.3-5.el5 set to be updated
—> Package php53-pdo.x86_64 0:5.3.3-5.el5 set to be updated
–> Processing Conflict: php53-common conflicts php-common
–> Finished Dependency Resolution
php53-common-5.3.3-5.el5.x86_64 from base has depsolving problems
–> php53-common conflicts with php-common
Error: php53-common conflicts with php-common
You could try using –skip-broken to work around the problem
You could try running: package-cleanup –problems
package-cleanup –dupes
rpm -Va –nofiles –nodigest
The program package-cleanup is found in the yum-utils package.
thanks for the reply! sorry but i didn’t quite get this result.
i tried sudo make install inside the gd-2.0.11 directory and the result is this:
Making install in config
make[1]: Entering directory `/var/www/html/sites/all/libraries/gd-2.0.11/config’
make[2]: Entering directory `/var/www/html/sites/all/libraries/gd-2.0.11/config’
/bin/sh ../config/mkinstalldirs /usr/local/bin
/usr/bin/install -c gdlib-config /usr/local/bin/gdlib-config
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/var/www/html/sites/all/libraries/gd-2.0.11/config’
make[1]: Leaving directory `/var/www/html/sites/all/libraries/gd-2.0.11/config’
Making install in test
make[1]: Entering directory `/var/www/html/sites/all/libraries/gd-2.0.11/test’
make[2]: Entering directory `/var/www/html/sites/all/libraries/gd-2.0.11/test’
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/var/www/html/sites/all/libraries/gd-2.0.11/test’
make[1]: Leaving directory `/var/www/html/sites/all/libraries/gd-2.0.11/test’
make[1]: Entering directory `/var/www/html/sites/all/libraries/gd-2.0.11′
/bin/sh ./libtool –mode=link gcc -g -O2 -o annotate annotate.o ./libgd.la
gcc -g -O2 -o .libs/annotate annotate.o ./.libs/libgd.so -Wl,–rpath -Wl,/usr/local/lib
./.libs/libgd.so: undefined reference to `sqrt’
./.libs/libgd.so: undefined reference to `floor’
./.libs/libgd.so: undefined reference to `sin’
./.libs/libgd.so: undefined reference to `atan2′
./.libs/libgd.so: undefined reference to `cos’
collect2: ld returned 1 exit status
make[1]: *** [annotate] Error 1
make[1]: Leaving directory `/var/www/html/sites/all/libraries/gd-2.0.11′
make: *** [install-recursive] Error 1
I don’t think this is good because it has an error at the last line. I’m not very familiar with this. I really appreciate this guide.
Hi,
I suggest you find a local sysadmin that can log into your server and do the configuration for you. You’re trying to mix two things here, A) a yum install and B) a manual compile. The yum install will most likely break your system as it’ll do a PHP 5.1 to 5.3 upgrade and the manual compile will have dependency problems. Neither of which can be suitably explained in a blogpost comment I’m afraid.
oh shoot… i’m afraid i’m on my own to solve this. i need this as soon as possible for my site to be able to make scaled thumbnails for images. i don’t know any sysad that can check the server. if it were you, in which direction would you go, the yum or manual? Thank you very much!
would this upgrade my php?
# yum clean all
# yum update
# yum install php-gd
I have got the “conflicts with php-common” problem and fixed it installing the gd for the php version. In my case php 5.3:
yum install php53-gd
Now it works Ok.
This web site helped me after a half-day resolving the problem. Thanks a lot!!!
you’re use a word update library GD with:
# yum install ImageMagick
If run install and Complete ! ok here !!!