Compile php 5.3 on Centos 7 from RPM
Updated 5/7/2019
I recently had to build php 5.3.29 on a brand new Centos 7 Digital Ocean droplet.
Pretty simple process but I thought it would be a good idea to share my steps…
This will be a general simple to follow how-to on a brand new centos 7.x machine.
- Install the epel repo and rpm tools.
sudo yum -y install epel-release rpm-build rpmdevtools wget
- install the Centos development tools and libraries.
sudo yum -y groupinstall “Development Tools” “Server Platform Development” “Additional Development” “Compatibility libraries”
sudo yum -y install db4-devel pam-devel libedit-devel libtool-ltdl-devel libc-client-devel sqlite2-devel t1lib-devel libmcrypt-devel libtidy-devel freetds-devel aspell-devel recode-devel enchant-devel
- Setup the rpm build directory environment.
cd ~
rpmdev-setuptree
- Download the Centos 6 src rpm and rebuild it.
This rpm is based on the php-5.3.23-1.el6.remi.src.rpm that I modified to include the latest version of php 5.3 (5.3.29) and also fixed any pathing issues between Centos 6 and Centos 7.
wget https://dev-zero.org/files/php-5.3.29-1.el7.src.rpm
rpmbuild –rebuild php-5.3.29-1.el7.src.rpm
When the process is done you will have your Centos 7 php 5.3.29 rpm’s.
Wrote: ~/rpmbuild/RPMS/x86_64/php-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-cli-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-fpm-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-common-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-devel-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-imap-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-ldap-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-pdo-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-sqlite-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mysql-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mysqlnd-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-pgsql-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-process-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-odbc-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-soap-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-snmp-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-xml-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-xmlrpc-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mbstring-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-gd-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-bcmath-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-dba-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mcrypt-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-tidy-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-mssql-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-embedded-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-pspell-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-recode-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-intl-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-enchant-5.3.29-1.el7.x86_64.rpm
Wrote: ~/rpmbuild/RPMS/x86_64/php-debuginfo-5.3.29-1.el7.x86_64.rpm
All you have to do now is install them via yum.