原文 https://vpsineu.com/blog/how-to-build-and-install-php-5-6-9-from-source-on-ubuntu-14-04-vps/

In this tutorial we will show you how to build and install PHP 5.6.9 from source on an Ubuntu 14.04 VPS.

We all know that PHP-5 is by default available in the Ubuntu repositories. But many times there are situations where  for some crazy reason your application is not able to run on that particular version and you must upgrade it.

There are couple of ways to do that, and time time we will show you know to do that by using the PHP source package.


UPDATE THE SYSTEM

First thing to do is to log in to your Ubuntu VPS as ROOT via SSH. Once you are in make sure the Ubuntu 14.04 system is fully up-to-date by running the following commands in your terminal:

apt-get update
apt-get upgrade

INSTALL BUILD DEPENDENCIES

Next, to avoid compilation errors about missing build dependencies install the following packages:

apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libbz2-dev libjpeg-dev \
libfreetype6-dev libpng12-dev libxpm-dev libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev \
libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev libt1-dev libgd2-xpm-dev \
libgmp-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev \
libxslt1-dev libmcrypt-dev libdb5.3-dev
 

DOWNLOAD PHP

Now let’s download the latest PHP 5.6.9 archive from some PHP mirror using the commands below:

PHP_VERSION=5.6.9
wget -O /var/tmp/php-${PHP_VERSION}.tar.bz2 \
http://bg2.php.net/get/php-${PHP_VERSION}.tar.bz2/from/this/mirror

Once the download of the archive is done extract the PHP source in the /opt/build directory. Since this directory do not exist we will need to create it manually. Type:

mkdir -p /opt/build

and extract the newly downloaded PHP archive:

tar -xvjpf /var/tmp/php-${PHP_VERSION}.tar.bz2 -C /opt/build

and finally enter the directory:

cd /opt/build/php-${PHP_VERSION}

CONFIGURE PHP SOURCES

The configure options depend on your environment. In my case, I want to run PHP as FastCGI i.e PHP-FPM with many useful extensions enabled. You can run ./configure --help to find all available configure options. My configuration looks like the one below, so if you want to use it just copy + paste on your terminal and press “ENTER“:

./configure \
--enable-fpm \
--with-mcrypt \
--enable-mbstring \
--with-openssl \
--with-mysql \
--with-mysql-sock \
--with-gd \
--with-jpeg-dir=/usr/lib \
--enable-gd-native-ttf \
--with-pdo-mysql \
--with-libxml-dir=/usr/lib \
--with-mysqli=/usr/bin/mysql_config \
--with-curl \
--enable-zip \
--enable-sockets \
--with-zlib \
--enable-exif \
--enable-ftp \
--with-iconv \
--with-gettext \
--enable-gd-native-ttf \
--with-t1lib=/usr \
--with-freetype-dir=/usr \
--prefix=/opt/PHP-5.6 \
--with-config-file-path=/opt/PHP-5.6/etc \
--with-fpm-user=www-data \
--with-fpm-group=www-data

this command will make PHP 5.6.9 installed within the /opt/PHP-5.6 directory.


NOTE

if you encounter an error like

configure: error: freetype.h not found

even-though you installed libfreetype6-dev, then execute the following commands and try the ./configure again:

mkdir /usr/include/freetype2/freetype
ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h

COMPILE PHP

Now it’s time to compile PHP. So, run make to build the sources:

make

if the “make” command is not installed you can install it with:

apt-get install make

and run “make” again.

once the compilation is completed, optionally you may want to run make test to test the set-up:

make test

参考: 

INSTALL PHP

And finally, in the test goes well, run make install to install the compiled PHP to /opt/PHP-5.6

make install

That’s it.


VERIFY PHP VERSION

To check the PHP version, run:

/opt/PHP-5.6/bin/php -v

PHP 5.6.9 (cli) (built: Jun 11 2015 09:41:12)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

If you’re one of our Linux VPS Hosting customers we can help you to build and install PHP 5.6.9 from source on your virtual server for you free of charge. Just contact us and some of our experts will complete your request immediately.

【转】How to build and install PHP 5.6.9 from source on Ubuntu 14.04 VPS的更多相关文章

  1. How To Install Tinc and Set Up a Basic VPN on Ubuntu 14.04

    Introduction In this tutorial, we will go over how to use Tinc, an open source Virtual Private Netwo ...

  2. Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10(转)

    Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10 1 get the source code sudo apt-get install ...

  3. How To Install Apache Kafka on Ubuntu 14.04

    打算学习kafka ,接触一些新的知识.加油!!! 参考:https://www.digitalocean.com/community/tutorials/how-to-install-apache- ...

  4. How To Install and Configure Elasticsearch on Ubuntu 14.04

    Reference: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsear ...

  5. Install eclipse ns3 in ubuntu 14.04

    1. NS3 install 参考NS3 tutorial即可. 2.eclipse 2.1下载 下载地址:http://www.eclipse.org/downloads/              ...

  6. Install Google Pinyin on Ubuntu 14.04

    Install Google Pinyin on Ubuntu 14.04 I've been spending more and more time on Ubuntu and I'm not us ...

  7. Ubuntu 14.04 – How to install xrdp in Ubuntu 14.04

    http://c-nergy.be/blog/?p=5305 Hello World, Ubuntu 14.04 has been released on April 17th 2014 and we ...

  8. 【转】install intel wireless 3165 driver for ubuntu 14.04.3

    [转]install intel wireless 3165 driver for ubuntu 14.04.3 Ubuntu 14.04.3 with 3.19 kernel can’t drive ...

  9. Ubuntu 14.04 install emacs 24.5

    1.前期准备工作 2.安装基础构件工具 3.下载emacs编译需要的依赖库 4.下载emacs24.5编译安装 5.下载并安装我的emacs配置文件 6.配置tmux和zsh 1. 前期准备工作 在阿 ...

随机推荐

  1. CSS3的基础知识点

    面临找工作之际,又将CSS3的基础知识撸了一把,做了相应的笔记,主要是方便自己查阅,参考的是W3C的知识.    1.CSS背景 (1).background-size 属性 background-s ...

  2. Struts入门学习(一)

    刚开始学习框架的时候感觉很简单,都是用到javaEE的相关框架,自己就想研究源码,但是学了很久之后毫无头绪,所以还是扎扎实实学好Struts毕竟框架做起来要比自己写javaEE要简单,下面我们就来一步 ...

  3. gdb常用调试命令

    一般来说,GDB主要帮忙你完成下面四个方面的功能: 1.启动你的程序,可以按照你的自定义的要求随心所欲的运行程序.    2.可让被调试的程序在你所指定的调置的断点处停住.(断点可以是条件表达式)   ...

  4. 读取memo中某行内容

    方法1 可用以下代码读取Memo中指定行的内容: var   aLine:String; begin   aLine:=Memo1.Lines[2]; end; 在使用中,读取的行在Memo中需要保证 ...

  5. Visual Studio 2013 新增web项目IIS Express的64位版   转载来源http://www.cnblogs.com/jianyus/p/3524335.html

    使用Visual Studio 2012开发SharePoint的应该都遇到过下面的错误“SharePoint 在32位进程中不受支持”,而怎么修改目标平台都不好使,因为VS 2012所配备的IIS ...

  6. C++ inline和#define宏的区别

    (1)什么是内联函数? 内联函数是指那些定义在类体内的成员函数,即该函数的函数体放在类体内. (2)为什么要引入内联函数?当然,引入内联函数的主要目的是:解决程序中函数调用的效率问题.另外,前面我们讲 ...

  7. mnesia

    1.模式创建 mnesia:create_schema([node()|nodes()]).集群的节点之间创建模式 2.启动和停止 application:start(mnesia). applica ...

  8. sql标识符和格式

    数据库名是一个标识符,表名也是一个标识符,在SQL SERVER中标识符分为两类: (1).常规标识符;(2).分隔标识符两者重要的区别:常规标识符必须严格遵守命名的规定,而分隔标识符则可以不遵守命名 ...

  9. js事件冒泡和捕捉

    (1)冒泡型事件:事件按照从最特定的事件目标到最不特定的事件目标(document对象)的顺序触发. IE 5.5: div -> body -> document IE 6.0: div ...

  10. 调用Lua出错

    错误提示:Could not load file or assembly 'lua51' or one of its dependencies. An attempt was made to load ...