Compile PHP 5.3 on Red Hat Linux

I recently compiled PHP 5.3 on RHEL 5.3, and I thought that I would share my configuration options.

First install the dependencies:
yum install mysql mysql-server mysql-devel perl-DBD-MySQL perl-DBI httpd httpd-devel httpd-suexec apr apr-devel apr-util apr-util-devel gd gd-devel gd-progs libjpeg-devel libpng-devel freetype-devel freetype-utils libxml2-devel curl-devel

./configure \
–build=i386-redhat-linux \
–host=i386-redhat-linux \
–target=i386-redhat-linux-gnu \
–program-prefix= \
–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=/usr/com \
–mandir=/usr/share/man \
–infodir=/usr/share/info \
–with-libdir=lib \
–with-config-file-path=/etc \
–with-config-file-scan-dir=/etc/php.d \
–disable-debug \
–disable-versioning \
–with-pic \
–disable-rpath \
–with-pear \
–with-curl \
–with-exec-dir=/usr/bin \
–with-freetype-dir=/usr \
–without-gdbm \
–with-gettext \
–with-iconv \
–with-expat-dir=/usr \
–with-zlib \
–with-layout=GNU \
–enable-exif \
–enable-ftp \
–enable-magic-quotes \
–enable-sockets \
–enable-sysvsem \
–enable-sysvshm \
–enable-sysvmsg \
–enable-track-vars \
–enable-trans-sid \
–enable-yp \
–enable-wddx \
–with-kerberos \
–enable-ucd-snmp-hack \
–without-unixODBC \
–enable-memory-limit \
–enable-shmop \
–enable-calendar \
–enable-dbx \
–enable-dio \
–with-mysql=/usr \
–with-mysql-sock=/var/lib/mysql/mysql.sock \
–with-mysqli=/usr/bin/mysql_config \
–with-apxs2=/usr/sbin/apxs \
–without-sqlite \
–with-xml \
–without-odbc \
–enable-dom \
–disable-dba \
–enable-pdo \
–enable-xmlreader \
–enable-xmlwriter \
–with-xmlrpc \
–with-soap \
–with-gd \
–with-openssl \
–with-libxml-dir=/usr \
–disable-cgi

make
make test
make install

You should have a working version of PHP 5.

Check your version:
php -v

Check your modules:
php -i

Leave a Reply