PHP: Install from Source

In both cases, CentOS or Ubuntu, you'll need to install development libraries for the packages to build against.


If the PHP configuration of a system provides the configuration options for when it was built, that is the best starting point.

Otherwise, here is a generic list of arguments for configuration. This will build PHP as a CGI, and look for a configuration in /etc/php/php.ini.

./configure '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--prefix=/usr/lib/php5.3' '--mandir=/usr/lib/php5.3/man' '--infodir=/usr/lib/php5.3/info' '--libdir=/usr/lib/php5.3/lib' '--with-libdir=lib' '--disable-maintainer-zts' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--without-curlwrappers' '--without-enchant' '--disable-exif' '--disable-fileinfo' '--disable-ftp' '--with-gettext' '--with-gmp' '--with-mhash' '--disable-intl' '--without-kerberos' '--enable-mbstring' '--with-mcrypt' '--with-mssql' '--with-onig=/usr' '--with-openssl' '--with-openssl-dir=/usr' '--disable-pcntl' '--without-pgsql' '--disable-posix' '--without-pspell' '--without-recode' '--disable-shmop' '--without-snmp' '--enable-soap' '--disable-sockets' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-wddx' '--with-xmlrpc' '--with-xsl' '--enable-zip' '--with-zlib' '--disable-debug' '--without-cdb' '--without-db4' '--disable-flatfile' '--without-gdbm' '--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--disable-gd-jis-conv' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-mysql=mysqlnd' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-mysqli=mysqlnd' '--without-oci8' '--with-pdo-dblib' '--with-pdo-mysql=mysqlnd' '--without-pdo-pgsql' '--with-pdo-sqlite=/usr' '--without-pdo-odbc' '--without-readline' '--without-libedit' '--without-mm' '--with-sqlite=/usr' '--enable-sqlite-utf8' '--with-config-file-path=/etc/php/' '--disable-embed' '--enable-cgi' '--disable-fpm' '--without-apxs2' | tee config.out

This configuration will build (ideally) these modules:

  • bcmath
  • bz2
  • calendar
  • Core
  • ctype
  • curl
  • date
  • dom
  • ereg
  • filter
  • gd
  • gettext
  • gmp
  • hash
  • iconv
  • json
  • libxml
  • mbstring
  • mcrypt
  • mhash
  • mssql
  • mysql
  • mysqli
  • mysqlnd
  • openssl
  • pcre
  • PDO
  • pdo_dblib
  • pdo_mysql
  • pdo_sqlite
  • Phar
  • Reflection
  • session
  • SimpleXML
  • soap
  • SPL
  • SQLite
  • sqlite3
  • standard
  • tokenizer
  • xml
  • xmlreader
  • xmlrpc
  • xmlwriter
  • xsl
  • zip
  • zlib