【转】How to build and install PHP 5.6.9 from source on Ubuntu 14.04 VPS
原文 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的更多相关文章
- 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 ...
- 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 ...
- How To Install Apache Kafka on Ubuntu 14.04
打算学习kafka ,接触一些新的知识.加油!!! 参考:https://www.digitalocean.com/community/tutorials/how-to-install-apache- ...
- How To Install and Configure Elasticsearch on Ubuntu 14.04
Reference: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsear ...
- Install eclipse ns3 in ubuntu 14.04
1. NS3 install 参考NS3 tutorial即可. 2.eclipse 2.1下载 下载地址:http://www.eclipse.org/downloads/ ...
- 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 ...
- 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 ...
- 【转】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 ...
- Ubuntu 14.04 install emacs 24.5
1.前期准备工作 2.安装基础构件工具 3.下载emacs编译需要的依赖库 4.下载emacs24.5编译安装 5.下载并安装我的emacs配置文件 6.配置tmux和zsh 1. 前期准备工作 在阿 ...
随机推荐
- MVC写在Model文件夹下,登录注册等页面定义的变量规则,不会被更新实体模型删除
一下图为我的model文件夹
- 【LeetCode】419. Battleships in a Board
Given an 2D board, count how many different battleships are in it. The battleships are represented w ...
- Java线程--interrupt join yield setDaemon常用方法的使用
概念: 操作系统可以有多个进程,一个线程可以有一个或多个线程.进程与进程之间不共享内存,都在各自的空间中运行.而线程不仅可以共享内存,还可以用有一个自己的内存空间,叫做线程栈. 线程又称轻量级进程.J ...
- TypeError: document.getELementById is not a function
这个错误困扰了我好几个小时,在网上也百度了好久类似的问题但都没有结果,反反复复看了好多遍,才发现,原来是document.getELementById 里面的Element的字母 l 我写成了大写的L ...
- digitalocean更换机房教程
使用本站优惠链接注册digitalocean账户,可获赠10美元digitalocean优惠码.新用户点击create,即可创建一台新的vps,10美元余额足够你使用一台512MB内存的vps长达两月 ...
- digitalocean优惠码30美元1G内存VPS免费使用两个月
著名的云主机服务商CloudWays送福利啦!CloudWays是一家云主机网站服务商,与Digitalocean和亚马逊AWS开展合作,新用户注册验证手机即可赠送价值30美元的免费VPS主机. 申请 ...
- ubuntu下打开chm文件
CHM文件格式是微软1998年推出的基于HTML文件特性的帮助文件系统,以替代早先的WinHelp帮助系统,它在Windows 98中把CHM类型文件称作“已编译的HTML帮助文件”. chm文件因为 ...
- Python 拆分字符串
数:split() Python中有split()和os.path.split()两个函数,具体作用如下:split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(list ...
- E - 小晴天老师系列——我有一个数列!
E - 小晴天老师系列——我有一个数列! Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/O ...
- javascript注释规范
注释在代码编写过程中的重要性,写代码超过半年的就能深深的体会到.没有注释的代码都不是好代码.为了别人学习,同时为了自己以后对代码进行'升级',看看js/javascript代码注释规范与示例.来自:h ...