Skip to content

Instantly share code, notes, and snippets.

@flaudisio
Created November 14, 2012 03:24
Show Gist options
  • Save flaudisio/4070059 to your computer and use it in GitHub Desktop.
Save flaudisio/4070059 to your computer and use it in GitHub Desktop.
PHP 5.3 "shared mode" configuration
#!/bin/sh
PHP_VERSION=5.3.18
SAPI_MODE="apache" # fastcgi / apache
SRC_HOME="${HOME}/src"
JOBS="$(( $( fgrep -i 'model name' /proc/cpuinfo | wc -l ) * 2 ))"
mkdir -p "${SRC_HOME}"
cd "${SRC_HOME}"
wget http://br2.php.net/distributions/php-${PHP_VERSION}.tar.bz2
tar xjf php-${PHP_VERSION}.tar.bz2
cd php-"$PHP_VERSION"
[ ! -e config.guess ] && {
echo "Fatal Error: config.guess not found."
exit 1
}
SYSTEM="$( sh config.guess )"
echo
echo "------------------------------------------------------------------------"
echo " Initializing PHP $PHP_VERSION configuration, please wait..."
echo " System ...... $SYSTEM -- $( uname -rnp )"
echo " Date/time ... $( date )"
echo "------------------------------------------------------------------------"
echo
case $SAPI_MODE in
fastcgi)
SAPI_MODE="--enable-cgi --enable-fpm"
;;
apache)
SAPI_MODE="--disable-cgi --with-apxs2=/usr/bin/apxs2"
;;
*)
echo "Error: invalid SAPI mode selected.\n"
exit 1
;;
esac
./configure \
--host="$SYSTEM" --build="$SYSTEM" --target="$SYSTEM" \
--cache-file=../config.cache \
--prefix=/usr/local/php-"$PHP_VERSION" --exec-prefix=/usr/local/php-"$PHP_VERSION" \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php/conf.d \
--disable-all \
--enable-ctype --enable-dom --enable-fileinfo --enable-filter \
--enable-hash --enable-libxml --enable-pcntl --enable-phar=shared \
--enable-posix=shared --enable-tokenizer=shared --enable-xml \
--with-pspell=shared --without-recode \
--enable-session --enable-shmop --enable-simplexml \
--enable-sysvsem --enable-sysvshm --enable-sysvmsg \
$SAPI_MODE --enable-cli \
--enable-calendar --enable-exif=shared --enable-ftp --enable-zip \
--enable-bcmath=shared \
--enable-json=shared \
--with-pic --with-bz2=shared --with-gmp=shared --with-iconv \
--with-zlib=shared --with-curl=shared --with-gd=shared \
--with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --with-zlib-dir=/usr \
--with-freetype-dir=/usr --with-t1lib --enable-gd-native-ttf --enable-gd-jis-conv \
--enable-mbstring=shared --enable-mbregex \
--enable-bcmath=shared \
--with-gettext=shared --enable-intl=shared \
--with-imap=shared --with-imap-ssl --with-kerberos \
--with-ldap=shared --with-ldap-sasl \
--with-openssl=shared --with-mcrypt=shared --with-mhash --disable-dba \
--enable-mysqlnd --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-mysql-sock=/var/run/mysqld/mysqld.sock \
--without-sqlite --without-sqlite3 \
--with-pgsql=shared --enable-pdo=shared \
--without-pdo-sqlite --with-pdo-mysql=shared,mysqlnd --with-pdo-pgsql=shared \
--with-snmp=shared --enable-soap=shared --enable-sockets \
--with-tidy=shared --enable-wddx=shared \
--with-xmlrpc=shared --enable-xmlreader=shared --enable-xmlwriter=shared \
--with-xsl=shared \
--disable-debug --disable-magic-quotes --disable-rpath
echo "\nMaravilha, Albertô!!\n"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment