Created
July 17, 2012 17:51
-
-
Save ziadoz/3130816 to your computer and use it in GitHub Desktop.
Upgrade Ubuntu 10.04 to PHP 5.4.8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Dependencies | |
# sudo apt-get install build-essential | |
# sudo apt-get build-dep php5 | |
sudo apt-get install libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev bzip2 libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libvpx-dev libxpm-dev libgmp3-dev libicu-dev libpspell-dev libtidy-dev freetds-dev unixodbc-dev librecode-dev libglib2.0-dev libsasl2-dev libgeoip-dev imagemagick libmagickcore-dev libmagickwand-dev | |
# Stop Apache | |
sudo service apache2 stop | |
# Cleanup Packages | |
sudo apt-get autoremove | |
# Remove Ubuntu PHP Packages | |
sudo apt-get remove php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-geoip php5-imagick php5-intl php5-mcrypt php5-mysql php5-xdebug php5-xsl | |
# Remove PECL Packages | |
sudo pecl uninstall apc | |
sudo pecl uninstall geoip | |
sudo pecl uninstall xdebug | |
# Get PHP 5.4.8 Source | |
wget -O php-5.4.8.tar.bz2 http://www.php.net/get/php-5.4.8.tar.bz2/from/this/mirror | |
tar jxf php-5.4.8.tar.bz2 | |
cd php-5.4.8/ | |
# Configure PHP Source | |
# Note: Use `php-config` utility to determine your existing PHP configure options. | |
./configure \ | |
--prefix=/usr \ | |
--with-apxs2=/usr/bin/apxs2 \ | |
--with-config-file-path=/etc/php5/apache2 \ | |
--with-config-file-scan-dir=/etc/php5/conf.d \ | |
--build=x86_64-linux-gnu \ | |
--host=x86_64-linux-gnu \ | |
--sysconfdir=/etc \ | |
--mandir=/usr/share/man \ | |
--disable-debug \ | |
--with-regex=php \ | |
--disable-rpath \ | |
--disable-static \ | |
--with-pic \ | |
--with-layout=GNU \ | |
--with-pear=/usr/share/php \ | |
--enable-calendar \ | |
--enable-sysvsem \ | |
--enable-sysvshm \ | |
--enable-sysvmsg \ | |
--enable-bcmath \ | |
--with-bz2 \ | |
--enable-ctype \ | |
--with-db4 \ | |
--without-gdbm \ | |
--with-iconv \ | |
--enable-exif \ | |
--enable-ftp \ | |
--with-gettext \ | |
--enable-mbstring \ | |
--with-pcre-regex=/usr \ | |
--enable-shmop \ | |
--enable-sockets \ | |
--enable-wddx \ | |
--with-libxml-dir=/usr \ | |
--with-zlib \ | |
--with-kerberos=/usr \ | |
--with-openssl=/usr \ | |
--enable-soap \ | |
--enable-zip \ | |
--with-mhash=yes \ | |
--with-exec-dir=/usr/lib/php5/libexec \ | |
--with-system-tzdata \ | |
--without-mm \ | |
--with-curl=shared,/usr \ | |
--with-enchant=shared,/usr \ | |
--with-zlib-dir=/usr \ | |
--with-gd \ | |
--enable-gd-native-ttf \ | |
--with-gmp=shared,/usr \ | |
--with-jpeg-dir=shared,/usr \ | |
--with-xpm-dir=shared,/usr/X11R6 \ | |
--with-png-dir=shared,/usr \ | |
--with-freetype-dir=shared,/usr \ | |
--enable-intl=shared \ | |
--with-ttf=shared,/usr \ | |
--with-t1lib=shared,/usr \ | |
--with-ldap=shared,/usr \ | |
--with-ldap-sasl=/usr \ | |
--with-mysql=shared,/usr \ | |
--with-mysqli=shared,/usr/bin/mysql_config \ | |
--with-pspell=shared,/usr \ | |
--with-unixODBC=shared,/usr \ | |
--with-recode=shared,/usr \ | |
--with-xsl=shared,/usr \ | |
--with-snmp=shared,/usr \ | |
--with-sqlite=shared,/usr \ | |
--with-sqlite3=shared,/usr \ | |
--with-mssql=shared,/usr \ | |
--with-tidy=shared,/usr \ | |
--with-xmlrpc=shared \ | |
--with-pgsql=shared,/usr \ | |
--enable-fpm \ | |
--with-mcrypt \ | |
--enable-pdo=shared,/usr \ | |
--with-pdo-mysql=shared,/usr \ | |
--with-pdo-sqlite=shared,/usr \ | |
--with-pdo-pgsql=shared,/usr \ | |
--with-curlwrappers \ | |
--enable-json \ | |
--enable-shared \ | |
--enable-mysqlnd=shared \ | |
# Install PHP | |
make | |
make test | |
sudo make install | |
# Update PEAR and Install PECL Packages | |
sudo pear update-channels | |
sudo pecl install apc | |
sudo pecl install geopip | |
sudo pecl install xdebug | |
# Install Imagick RC2 | |
wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz | |
tar xvfz imagick-3.1.0RC2.tgz | |
cd imagick-3.1.0RC2 | |
phpize | |
./configure --prefix=/usr/lib --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes | |
make | |
sudo make install | |
# Install XDebug 2.2.1 | |
wget http://xdebug.org/files/xdebug-2.2.1.tgz | |
tar xvfz xdebug-2.2.1.tgz | |
cd xdebug-2.2.1 | |
phpize | |
./configure --enable-xdebug | |
make | |
sudo make install | |
# Update PHP INI Extensions | |
# Use `php-m` to see a list of active modules. | |
sudo rm /etc/php5/conf.d/mcrypt.ini | |
sudo rm /etc/php5/conf.d/gd.ini | |
sudo echo 'extension=imagick.so' | sudo tee /etc/php5/conf.d/xdebug.ini | |
sudo echo 'zend_extension_ts=xdebug.so' | sudo tee /etc/php5/conf.d/xdebug.ini | |
# Start Apache | |
sudo service apache2 start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Install via PPA. | |
# References: | |
# [1] Blog: http://www.upubuntu.com/2012/03/how-to-upgrade-install-php-540-under.html | |
sudo apt-get install python-software-properties | |
sudo add-apt-repository ppa:ondrej/php5 | |
sudo apt-get update | |
sudo apt-get install php5 | |
# 2) Compile from Source. | |
# Note: Change --with-libdir=lib64 to --with-libdir=lib if you are running 32bit. | |
# Install Dependencies: | |
sudo apt-get install libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev bzip2 libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libvpx-dev libxpm-dev libgmp3-dev libicu-dev libpspell-dev libtidy-dev libsasl2-dev | |
# Get PHP Source: | |
wget -O php-5.4.8.tar.bz2 http://www.php.net/get/php-5.4.8.tar.bz2/from/this/mirror | |
tar jxf php-5.4.8.tar.bz2 | |
cd php-5.4.8/ | |
# Compile. | |
./configure \ | |
--prefix=/usr/local \ | |
--with-libdir=lib64 \ | |
--with-layout=PHP \ | |
--with-pear= \ | |
--with-apxs2=/usr/bin/apxs2 \ | |
--enable-calendar \ | |
--enable-bcmath \ | |
--with-gmp= \ | |
--enable-exif \ | |
--with-mcrypt \ | |
--with-mhash \ | |
--with-zlib \ | |
--with-bz2 \ | |
--enable-zip \ | |
--enable-ftp \ | |
--enable-mbstring \ | |
--with-iconv \ | |
--enable-intl \ | |
--with-icu-dir=/usr \ | |
--with-gettext \ | |
--with-pspell=/usr \ | |
--enable-sockets \ | |
--with-openssl \ | |
--with-curl \ | |
--with-curlwrappers \ | |
--with-gd \ | |
--enable-gd-native-ttf \ | |
--with-jpeg-dir=/usr \ | |
--with-png-dir=/usr \ | |
--with-xpm-dir=/usr \ | |
--with-vpx-dir=/usr \ | |
--with-zlib-dir=/usr \ | |
--with-freetype-dir=/usr \ | |
--with-t1lib=/usr \ | |
--with-libxml-dir=/usr \ | |
--with-mysql=mysqlnd \ | |
--with-mysqli=mysqlnd \ | |
--with-pdo-mysql=mysqlnd \ | |
--with-pgsql \ | |
--enable-soap \ | |
--with-xmlrpc \ | |
--with-xsl \ | |
--with-tidy \ | |
--with-readline \ | |
--enable-pcntl \ | |
--enable-sysvsem \ | |
--enable-sysvshm \ | |
--enable-sysvmsg \ | |
--enable-shmop \ | |
--with-pcre-regex \ | |
--with-imap \ | |
--with-imap-ssl \ | |
--with-snmp \ | |
--with-kerberos \ | |
make | |
make test | |
sudo make install | |
# Compile (without overwriting Apache Module). | |
./configure \ | |
--prefix=/usr/local/php/5.4 \ | |
--disable-debug \ | |
--localstatedir=/usr/local/php/5.4/var \ | |
--sysconfdir=/usr/local/php/5.4/etc \ | |
--libexecdir=/usr/local/php/5.4/libexec \ | |
--with-config-file-path=/usr/local/php/5.4/etc \ | |
--with-config-file-scan-dir=/usr/local/php/5.4/etc/php5/conf.d \ | |
--with-libdir=lib \ | |
--with-layout=PHP \ | |
--with-pear= \ | |
--with-apxs2=/usr/bin/apxs2 \ | |
--enable-calendar \ | |
--enable-bcmath \ | |
--with-gmp= \ | |
--enable-exif \ | |
--with-mcrypt \ | |
--with-mhash \ | |
--with-zlib \ | |
--with-bz2 \ | |
--enable-zip \ | |
--enable-ftp \ | |
--enable-mbstring \ | |
--with-iconv \ | |
--enable-intl \ | |
--with-icu-dir=/usr \ | |
--with-gettext \ | |
--with-pspell=/usr \ | |
--enable-sockets \ | |
--with-openssl \ | |
--with-curl \ | |
--with-curlwrappers \ | |
--with-gd \ | |
--enable-gd-native-ttf \ | |
--with-jpeg-dir=/usr \ | |
--with-png-dir=/usr \ | |
--with-xpm-dir=/usr \ | |
--with-vpx-dir=/usr \ | |
--with-zlib-dir=/usr \ | |
--with-freetype-dir=/usr \ | |
--with-t1lib=/usr \ | |
--with-libxml-dir=/usr \ | |
--with-mysql=mysqlnd \ | |
--with-mysqli=mysqlnd \ | |
--with-pdo-mysql=mysqlnd \ | |
--with-pgsql \ | |
--enable-soap \ | |
--with-xmlrpc \ | |
--with-xsl \ | |
--with-tidy \ | |
--with-readline \ | |
--enable-pcntl \ | |
--enable-sysvsem \ | |
--enable-sysvshm \ | |
--enable-sysvmsg \ | |
--enable-shmop \ | |
--with-pcre-regex \ | |
--with-imap \ | |
--with-imap-ssl \ | |
--with-snmp \ | |
--with-kerberos \ | |
# Apache Module directory. | |
# Now you need to edit the Makefile and change the INSTALL_IT target. | |
# Take the code below and make the following replacements: | |
# 1) Replace <libexec> with the directory you specified with the --libexecdir switch above. | |
# 2) Replace <apxsdir> with the directory you specified with the --libexecdir switch above. | |
# 3) Replace <apachedir> with the directory where Apache is installed (I.e. /etc/apache2). | |
# Replace the old INSTALL_IT line of the Makefile with this new line. | |
# References: | |
# [1] Bug: https://bugs.php.net/bug.php?id=60812 | |
# [2] Homebrew PHP Formula: https://github.com/josegonzalez/homebrew-php/blob/master/Formula/php54.rb | |
INSTALL_IT = $(mkinstalldirs) '<libexec>/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)<apachedir>' && <apxsdir> -S LIBEXECDIR='<libexec>/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)<apachedir>' -i -a -n php5 libs/libphp5.so | |
# The new INSTALL_IT target would look like this (based upon the configuration above): | |
INSTALL_IT = $(mkinstalldirs) '/usr/local/php/5.4/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/etc/apache2' && /usr/bin/apxs2 -S LIBEXECDIR='/usr/local/php/5.4/libexec/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)/etc/apache2' -i -a -n php5 libs/libphp5.so | |
make | |
make test | |
sudo make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment