Skip to content

Instantly share code, notes, and snippets.

@Bittarman
Created December 18, 2013 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bittarman/8023356 to your computer and use it in GitHub Desktop.
Save Bittarman/8023356 to your computer and use it in GitHub Desktop.
Compiling PHP from source. (Debian system layout)

Installing / upgrading PHP

  • su into root.
  • cd to /usr/local/src
  • wget latest version, and check md5sum, then extract to current dir.
  • cd into php-X.X.X
  • Configure with the appropriate configure line below
  • make -j8 Where 8 is 2x the number of cores available.
  • make install
  • make clean

For php-fpm, restart with service php-fpm restart

For cli, ensure you run make clean repeat last 4 steps with the cli configure line

PHP-FPM configure line

./configure --with-config-file-path=/etc/php/fpm --with-config-file-scan-dir=/etc/php/fpm/conf.d --sysconfdir=/etc/php --prefix=/usr/local --disable-cli --disable-cgi --enable-fpm --with-pdo-mysql=mysqlnd --with-curl --enable-zip --with-tidy --with-openssl --enable-mbstring --enable-soap --with-imagick --with-iconv --with-mysqli=mysqlnd --enable-intl --with-gd --enable-gd-native-ttf --with-mcrypt --with-jpeg-dir=/usr/lib --enable-opcache

PHP-CLI configure line

./configure --with-config-file-path=/etc/php/cli/php.ini --with-config-file-scan-dir=/etc/php/cli/conf.d --sysconfdir=/etc/php --prefix=/usr/local --disable-cgi --with-pdo-mysql=mysqlnd --with-curl --enable-zip --with-tidy --with-openssl --enable-mbstring --enable-soap --with-imagick --with-iconv --with-mysqli=mysqlnd --enable-intl --with-gd --enable-gd-native-ttf --with-mcrypt --with-jpeg-dir=/usr/lib --with-zlib=/usr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment