系统环境:
CentOS 6.5 / 7.0 x86_64
Fedora 20 x86_64
下载 PHP 源码包

# wget http://cn2.php.net/distributions/php-5.5.15.tar.bz2
# tar xf php-5.5.15.tar.bz2 -C /usr/local/src/

添加 epel 源

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

安装依赖

# yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel

创建 www 用户

# groupadd www
# useradd -g www -s /sbin/nologin -M www

编译安装

# cd /usr/local/src/php-5.5.15/

# ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--with-readline \
--without-sqlite3 \
--without-pdo-sqlite \
--with-pear

参数说明:

""" 安装路径 """
--prefix=/usr/local/php \
""" php.ini 配置文件路径 """
--with-config-file-path=/etc \
""" 优化选项 """
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
""" 启用 opcache,默认为 ZendOptimizer+(ZendOpcache) """
--enable-opcache \
""" FPM """
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
""" MySQL """
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
""" 国际化与字符编码支持 """
--with-gettext \
--enable-mbstring \
--with-iconv \
""" 加密扩展 """
--with-mcrypt \
--with-mhash \
--with-openssl \
""" 数学扩展 """
--enable-bcmath \
""" Web 服务,soap 依赖 libxml """
--enable-soap \
--with-libxml-dir \
""" 进程,信号及内存 """
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
""" socket & curl """
--enable-sockets \
--with-curl \
""" 压缩与归档 """
--with-zlib \
--enable-zip \
--with-bz2 \
""" GNU Readline 命令行快捷键绑定 """
--with-readline \
""" 禁用 SQLite 支持扩展 """
--without-sqlite3 \
--without-pdo-sqlite \
""" 更多 PHP 扩展与应用库 """
--with-pear

如果你的 Web Server 使用的 Apache 请添加类似:--with-apxs2=/usr/local/apache/bin/apxs 参数。

关于 mysqlnd 请查看 什么是 PHP 的 MySQL Native 驱动? 或查看 MySQL 官方介绍:MySQL native driver for PHP, 或 Installation on Unix。

更多编译参数请使用 ./configure --help 查看。

# make -j4
# make install

如果想重新安装:

# make clean
# make clean all

# ./configure ...
# make -j4
# make install

配置 PHP

配置文件:

# cp php.ini-development /etc/php.ini

PHP-fpm 服务

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm

启动 php-fpm

# service php-fpm start
Starting php-fpm done

php-fpm 可用参数 start|stop|force-quit|restart|reload|status
添加 PHP 命令到环境变量

编辑 ~/.bash_profile,将:

PATH=$PATH:$HOME/bin
改为:
PATH=$PATH:$HOME/bin:/usr/local/php/bin

使 PHP 环境变量生效:

# . ~/.bash_profile

查看看 PHP 版本

# php -v
PHP 5.5.15 (cli) (built: Aug 3 2014 02:43:38)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

centos 源码安装php5.5的更多相关文章

  1. centos 6.4 源码安装php5.4 mysql5.5 apahce2

    centos 6.4 源码安装php5.4 mysql5.5 apahce2 博客分类: php   参考:http://blog.csdn.net/simpleiseasy/article/deta ...

  2. CentOS源码安装QT

    在VirtualBox上的CentOS下安装qt-everywhere-opensource-src-4.8.4 ,执行 ./confiure时失败,失败信息为:Basic XLib function ...

  3. 简单说明CentOS源码安装程序

    第一步.安装依赖包.一般官网会有依赖关系,没有就网上搜索一下. 第二步.下载源码包,上传至CentOS服务器 第三步.解压缩 第四步.进入源码文件夹 第五步.执行./configure,这一步主要是为 ...

  4. CentOS 源码安装MySQL5.7

    一.安装方式源码安装,源码包名称mysql-boost-5.7.27.tar.gz,此版本包含boost库,在解压后的boost路径下.安装时,可以-DDOWNLOAD_BOOST=1 -DWITH_ ...

  5. CentOS源码安装Wireshark

    (2019年2月19日注:这篇文章原先发在自己github那边的博客,时间是2016年8月25日) Wireshark为网络管理员常用的一个网络管理工具,通过使用这个软件,我们可以对本机网卡上的经过的 ...

  6. linux(centos)源码安装git

    最近使用一个开源库,部署的的时候需要用git克隆依赖库.刚好系统没安装git.就尝试了源码安装git. 源码下载地址:http://codemonkey.org.uk/projects/git-sna ...

  7. CentOS源码安装 Tomcat/8.0.24

    依个人的习惯,喜欢将源码安装在/usr/local这个目录下面: 第一步:下载源码 wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.2 ...

  8. Centos源码安装Python3

    CentOS7默认安装了python2.7.5,当需要使用python3的时候,可以手动下载Python源码后编译安装. 下载python(https://www.python.org/ftp/pyt ...

  9. CentOS源码安装搭建LNMP全过程(包括nginx,mysql,php,svn)【转】

    转自:http://blog.csdn.net/yanzi1225627/article/details/49123659 服务器环境为:CentOS6.5 64位 目标:搭建LNMP(Linux + ...

随机推荐

  1. matlab小数分数转换

    >> format short      %%%% MATLAB默认格式,小数显示 >> format rat    %%%%% 转成分数表示

  2. Javascript间歇调用和超时调用

    间歇调用:每隔指定的时间就执行一次代码 超时调用:在指定的时间过后执行代码  HTML Code  12345678910111213141516171819   <!DOCTYPE html& ...

  3. poj 1548(最小路径覆盖)

    题目链接:http://poj.org/problem?id=1548 思路:最小路径覆盖是很容易想到的(本题就是求最小的路径条数覆盖所有的点),关键是如何建图,其实也不难想到,对于当前点,如果后面的 ...

  4. shell bash使用,包括判断文件或文件夹是否存在举例

    Linux shell编程——if条件判断 if [ condition ] ;then //一定要注意[] 與裡面的內容要有空格隔开 例如 if [(空格)${a} -eq 3(空格)]; then ...

  5. python的OS库和正则表达式库

    摘自:http://blog.chinaunix.net/uid-16360955-id-3351990.html 作留存学习 1.常用内置函数:(不用import就可以直接使用) help(obj) ...

  6. mybatis if test 相等的情况怎样动态拼接sql

    今天程序须要依据前台的传过来的状态推断在数据库里是取 where a>b 还是 a<b 还是 a=0 的情况  搞了一下午最后试了下 在if 里面拼接  #{status}=#{statu ...

  7. 回溯法——最大团问题(Maximum Clique Problem, MCP)

    概述: 最大团问题(Maximum Clique Problem, MCP)是图论中一个经典的组合优化问题,也是一类NP完全问题.最大团问题又称为最大独立集问题(Maximum Independent ...

  8. Keywords Search(AC自动机模板)

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others ...

  9. java 对list 排序

    Comparable用Collections.sort方法对list排序有两种方法第一种是list中的对象实现Comparable接口,如下: /*** 根据order对User排序*/public  ...

  10. delphi局域网Ping各主机方法及设置本地ip方法

    1. 首先引用winsock单元 function PingHost(HostIP: String): Boolean; type PIPOptionInformation=^TIPOptionInf ...