Error When Compiling PHP in CentOS 64 Bit

Library files in CentOS 64 bit are stored in the directory /usr/lib64. But in normal 32 bit CentOS, library files are stored in /usr/lib so this causes a problem when trying to compile source code that looks for library files in /usr/lib. When using the default configure options for compiling PHP, the directory /usr/lib is searched for library files so if you have any 64 bit applications installed, their associated library files will not be found. For example, trying to compile PHP with the configure option:

--with-mysql=/usr

will result in the error:

/usr/bin/ld: cannot find -lmysqlclient

You can fix this MySQL error and other configure errors relating to library files not being found by adding the following option to the configure line:

--with-libdir=lib64

Code