Last Updated: February 25, 2016
·
483
· computeraddictumm

Manually Building PHP

There are times that you wanted to install a specific version of PHP but ended up scratching your head since your favorite repositories doesn't support your desired version anymore. I know that feeling. Here's how you can install your desired PHP version without having to rely on repositories.
Shout out to my colleague Tope for this helpful tut.

  1. Download compressed package of the PHP version that you want to install on PHP's Website.
  2. Extract the package.
  3. Change working directory to the directory of the extracted package
  4. Run ./configure ( you can add or modify other PHP extensions by specifying additional options to the ./configure script Ex. ./configure --enable-zip --enable-bcmath and so on )
  5. Run make
  6. Run make test (Optional)
  7. Run make install

Extensions need for SugarCRM 7 to run. Please disregard since this is for OP's purpose only
./configure --build=x8664-redhat-linux-gnu --host=x8664-redhat-linux-gnu --target=x86_64-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/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib64 --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 --with-zlib --with-layout=GNU --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --with-kerberos --enable-ucd-snmp-hack --enable-shmop --enable-calendar --with-libxml-dir=/usr --enable-xml --with-mhash --with-apxs2=/usr/sbin/apxs --libdir=/usr/lib64/php --with-mysql --with-mysqli --with-gd --disable-dom --disable-dba --without-unixODBC --disable-phar --disable-fileinfo --without-pspell --disable-wddx --disable-posix --disable-sysvmsg --disable-sysvshm --disable-sysvsem --enable-bcmath --with-curl --with-imap --with-imap-ssl --enable-mbstring --enable-soap --enable-zip

Using the above extensions, you are going to encounter errors. Most of them are caused by missing libraries. Install corresponding libraries first and run configure script again.