php 安装教程

本文采用php7.0.1作为样例,进行安装。

系统环境:

  CentOS6.7.

  gcc 4.8.2

  libzip 1.0.1


在安装之前,可以先更新CentOS系统。

yum -y update

下载相应依赖文件

wget "http://cn2.php.net/distributions/php-7.0.1.tar.gz"

wget "http://www.nih.at/libzip/libzip-1.0.1.tar.gz"

解压相应文件

tar xvf php-7.0.1.tar.gz
tar xvf libzip-1.0.1.tar.gz

安装libzip库

cd libzip-1.0.1
./configure
make & make install

安装依赖包

此处可能会碰到so文件找不到的情况。由于为搜索/usr/lib64目录的原因,一般的解决方法就是直接软连接过去。

yum -y install gmp-devel libc-client-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
ln -s /usr/lib64/libldap* /usr/lib/

编译安装PHP7.0.1

./configure --prefix=/usr/local/php701 --enable-fpm  --with-fpm-user=www --with-fpm-group=www --with-kerberos --with-openssl --with-pcre-regex --with-zlib     --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --with-gettext --with-gmp --enable-gd-jis-conv --enable-gd-native-ttf --with-imap --with-imap-ssl  --enable-intl  --with-ldap --enable-mbstring --with-libmbfl --with-mcrypt --with-mysqli --with-mysql-sock  --enable-pcntl --with-pdo-mysql --enable-soap  --enable-sockets  --with-xmlrpc --with-xsl --enable-zip --enable-mysqlnd --enable-maintainer-zts --enable-zend-signals
make & make install
ln -s /usr/local/php701/bin/php /usr/local/bin/
ln -s /usr/local/php701/bin/phpize /usr/local/bin/
ln -s /usr/local/php701/bin/php-config /usr/local/bin/

安装redis for php 扩展

由于redis master 分支暂时不支持 php7.0.1,所以,使用phpredis支持php7的分支进行安装

wget 'https://github.com/phpredis/phpredis/archive/php7.zip'
unzip php7.zip
cd phpredis-php7
phpize
./configure
make & make install

安装memcached for php 扩展

memcached 依赖 libmemcached 和 libevent 两个包

安装libevent

wget 'https://github.com/nmathewson/Libevent/archive/release-2.0.22-stable.tar.gz'
tar xvf release-2.0.22-stable.tar.gz
cd Libevent-release-2.0.22-stable/
./configure && make && make install

安装libmemcached

wget 'https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz'
tar xvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18 ./configure make && make install

安装php-memcached

由于memcached目前版本不支持php7.1,在php-memcached讨论中找到了这个解决方法。

git clone 'https://github.com/rlerdorf/php-memcached.git'
cd php-memcached/
phpize
./configure
make && make install

 

至此,php 7.0.1 已安装完毕。

安装扩展如下:

'./configure'  '--prefix=/usr/local/php701' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--enable-debug' '--with-kerberos' '--with-openssl' '--with-pcre-regex' '--with-zlib' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--enable-exif' '--enable-ftp' '--with-gd' '--with-gettext' '--with-gmp' '--enable-gd-jis-conv' '--enable-gd-native-ttf' '--with-imap' '--with-imap-ssl' '--enable-intl' '--with-ldap' '--enable-mbstring' '--with-libmbfl' '--with-mcrypt' '--with-mysqli' '--with-mysql-sock' '--enable-pcntl' '--with-pdo-mysql' '--enable-soap' '--enable-sockets' '--with-xmlrpc' '--with-xsl' '--enable-zip' '--enable-mysqlnd' '--enable-maintainer-zts' '--enable-zend-signals'

  

  

最新文章

  1. PHP设计模式 迭代器模式
  2. jquery实现自动补全邮箱地址
  3. browser shell
  4. Sql server之路 (一)基础学习
  5. 弹窗插件layer
  6. C语言简单实现sizeof功能代码
  7. Javascript 多线程?
  8. ODI KM二次开发手册
  9. 快速构建Windows 8风格应用10-设备方向
  10. PHP5中PDO的入门教程
  11. Javaweb之Jsp
  12. GWT开端
  13. 安装配置rsync服务端
  14. [转载]Word直接发布新浪博客(以Word 2013为例)
  15. HDFS配额管理(实战)
  16. 使用Intent传递对象
  17. 2018-2019-2 20165315 《网络对抗技术》Exp4 恶意代码分析
  18. Android 7.0 fiddler代理抓不到https请求的解决办法
  19. redis 的 docker 镜像使用
  20. MySQL 中联合查询效率分析

热门文章

  1. .Net vs .Net Core,我改如何选择?看这一篇文章就够了
  2. excel排序技术记录
  3. Django 图片上传到数据库 并调用显示
  4. C语言程序设计(四) 键盘输入和屏幕输出
  5. CSS核心概念之盒子模型
  6. 常见的几种JavaScript内存泄露
  7. Code Index: 基于Lucene.Net的代码检索工具
  8. Git&Github入门
  9. 【开源】使用Angular9和TypeScript开发RPG游戏
  10. NeurIPS 2019 | 基于Co-Attention和Co-Excitation的少样本目标检测