下载 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=/usr/local/php/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[H1]

# make install

php 的编译时需要依赖pear package ,目前的问题错误"PEAR package PHP_Archive not installed",已经明显报出这个问题。 
因此编译使用参数 --without-pear   将pear 屏蔽掉编译安装后,再进行安装;同时因为phar 属于pear的一个库 ,所以不将phar关闭掉,同时还会报这个错误, 
同时需要使用 --disable-phar   编译参数.

./configure --without-pear  --disable-phar
make
make install

成功编译安装完成后,再安装pear

wget  http://pear.php.net/go-pear.phar 
/usr/local/bin/php go-pear.phar

如果想重新安装:

# 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


[H1]多核编译,加快make编译速度

转:php 5.5源码安装全过程的更多相关文章

  1. centos下mysql 5源码安装全过程记录

    参考:http://blog.csdn.net/mycwq/article/details/24488691 安装cmake,mysql 5.5以后的版本要通过cmake进行编译 在新装的CentOS ...

  2. PostGreSQL(1)-源码安装

    目录 简述 一.格式化磁盘 二.源码安装 PostGreSql 1. 安装 readline-devel 2. 安装 PostGresql 3. 设置环境变量 三. 初始化 1. 设置运行用户 2. ...

  3. 源码安装mysql5.6.37

    MYSQL 源码安装: 修改参数文件:vi /etc/security/limits.confmysql soft nproc 2047mysql hard nproc 16384mysql soft ...

  4. mono-3.4.0 源码安装时出现的问题 [do-install] Error 2 [install-pcl-targets] Error 1 解决方法

    Mono 3.4修复了很多bug,继续加强稳定性和性能(其实Mono 3.2.8 已经很稳定,性能也很好了),但是从http://download.mono-project.com/sources/m ...

  5. 搭建LNAMP环境(七)- PHP7源码安装Memcached和Memcache拓展

    上一篇:搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展 一.安装Memcached 1.yum安装libevent事件触发管理器 yum -y install libe ...

  6. 搭建LNAMP环境(二)- 源码安装Nginx1.10

    上一篇:搭建LNAMP环境(一)- 源码安装MySQL5.6 1.yum安装编译nginx需要的包 yum -y install pcre pcre-devel zlib zlib-devel ope ...

  7. 搭建LNAMP环境(一)- 源码安装MySQL5.6

    1.yum安装编译mysql需要的包 yum -y install gcc-c++ make cmake bison-devel ncurses-devel perl 2.为mysql创建一个新的用户 ...

  8. Greenplum 源码安装教程 —— 以 CentOS 平台为例

    Greenplum 源码安装教程 作者:Arthur_Qin 禾众 Greenplum 主体以及orca ( 新一代优化器 ) 的代码以可以从 Github 上下载.如果不打算查看代码,想下载编译好的 ...

  9. salt源码安装软件和yum安装软件

    上面简单列出了源码安装的sls文件书写思路. 涉及到一些固定的思路:如, 1,拷贝 解压安装时候需要依赖tar.gz存在 如果已安装则无需再次安装. 2,启动脚本 加入chk时候需要文件存在,如果已添 ...

随机推荐

  1. MDK5如何新建一个工程

    1.首先新建一个文件夹,然后在子文件夹下新建四个子文件,子文件分别为:CORE.HALLIB.OBJ.USER 2.打开MDK5,new一个工程,然后选择开发板芯片的型号 3.在这四个文件中分别添加相 ...

  2. AT2567 RGB Sequence dp

    正解:计数dp 解题报告: 传送门! umm其实我jio得dp的题目的话就难在思想昂,,,知道状态知道转移就不难辣QAQ 所以就不说别的了直接写下思路放下代码就over辣QAQ 最基础的思想就是f[i ...

  3. docker之Dockerfile指令介绍

    Docker通过对于在Dockerfile中的一系列指令的顺序解析实现自动的image的构建 通过使用build命令,根据Dockerfiel的描述来构建镜像 通过源代码路径的方式 通过标准输入流的方 ...

  4. 【托业】【新托业TOEIC新题型真题】学习笔记11-题库六-P7

    1.scam [skæm] n.骗局; 诡计; <美俚>诓骗; 故事;vt.欺诈; 诓骗; 2.interpersonal adj.人与人之间的; 人际的; 人与人之间的关系的; 涉及人与 ...

  5. centos安装卸载Postgresql数据库PGSQL10

    这几天ytkah正在测试Odoo,而Odoo12一定要PGSQL10否则安装数据库的时候会出错,所以就直接安装gpsql10.首先卸载旧版本postgresql yum remove postgres ...

  6. staticmethod()静态方法和classmethod类方法都是装饰器

    1.staticmethod()静态方法 使用@staticmethod目的是为了增加可读性,不需要参数self(不强制要求传递参数) 的方法都可以加上@staticmethod增加可读性 静态方法无 ...

  7. wx工具栏,菜单栏,状态栏

    #!/usr/bin/env python # -*- coding: utf- -*- import wx import wx.py.images class ToolbarFrame(wx.Fra ...

  8. C语言ini格式配置文件的读写

    依赖的类 /*1 utils.h *# A variety of utility functions. *# *# Some of the functions are duplicates of we ...

  9. 发现Boost官方文档的一处错误(numpy的ndarray)

    文档位置:https://www.boost.org/doc/libs/1_65_1/libs/python/doc/html/numpy/tutorial/ndarray.html shape在这里 ...

  10. Mac charles 抓取https请求,安装证书后还是显示unknown

    https://blog.csdn.net/qq_23114525/article/details/81460840 1. 配置证书 2. 设置钥匙串信任 3. 设置手机代理 端口号需要对应设置的端口 ...