推荐(免费):PHP7

安装PHP5下载解压二进制包[root@test-a src]# cd /usr/local/src/

[root@test-a src]# wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2

[root@test-a src]# tar jxvf php-5.6.32.tar.bz2编译安装PHP./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

#报错:

...

configure: error: Cannot find OpenSSL's

# 安装openssl

[root@test-a php-5.6.32]# yum install openssl-devel -y

...

Total size: 14 M

Total download size: 151 k

Downloading packages:

Delta RPMs disabled because /usr/bin/applydeltarpm not installed.

libselinux-utils-2.5-12.el7.x8 FAILED

http://mirrors.163.com/centos/7/os/x86_64/Packages/libselinux-utils-2.5-12.el7.x86_64.rpm: [Errno 14] HTTP Error 416 - Requested Range Not Satisfiable

Trying other mirror.

Error downloading packages:

libselinux-utils-2.5-12.el7.x86_64: [Errno 256] No more mirrors to try.

# 安装过程报错,需要安装deltarpm

[root@test-a php-5.6.32]# yum install deltarpm

...

Downloading packages:

No Presto metadata available for base

libselinux-utils-2.5-12.el7.x8 FAILED

http://mirrors.163.com/centos/7/os/x86_64/Packages/libselinux-utils-2.5-12.el7.x86_64.rpm: [Errno 14] HTTP Error 416 - Requested Range Not Satisfiable

Trying other mirror.

Error downloading packages:

libselinux-utils-2.5-12.el7.x86_64: [Errno 256] No more mirrors to try.

# 还是报错,由于之前用的Base源是163的,换回默认的Base源再试就OK了... :(

# 继续初始化配置过程,报错

...

checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution

[root@test-a php-5.6.32]# yum -y install bzip2-devel

# 继续报错

...

checking for stdarg.h... (cached) yes

checking for mcrypt support... yes

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

# 继续报错

[root@test-a php-5.6.32]# yum install -y libmcrypt-devel

#继续报错

...

checking for MySQL support... yes

checking for specified location of the MySQL UNIX socket... no

configure: error: Cannot find libmysqlclient_r under /usr/local/mysql.

Note that the MySQL client library is not bundled anymore!

# PHP默认是去/usr/local/mysql/lib/mysql/搜索,没有找到报错,复制或者做个软连接就行.

[root@test-a php-5.6.32]# cp /usr/local/mysql/lib/libmysqlclient.so /usr/local/mysql/lib/mysql/libmysqlclient_r.so

# 再次安装,苍了个天,看见Thank you...啦 成功!

...

Thank you for using PHP.

config.status: creating php5.spec

config.status: creating main/build-defs.h

config.status: creating scripts/phpize

config.status: creating scripts/man1/phpize.1

config.status: creating scripts/php-config

config.status: creating scripts/man1/php-config.1

config.status: creating sapi/cli/php.1

config.status: creating sapi/cgi/php-cgi.1

config.status: creating ext/phar/phar.1

config.status: creating ext/phar/phar.phar.1

config.status: creating main/php_config.h

config.status: executing default commands

# 编译

[root@test-a php-5.6.32]# make

...

Build complete.

Don't forget to run 'make test'.

# 安装

[root@test-a php-5.6.32]# make install查看php的模块(都是静态的)[root@test-a php-5.6.32]# /usr/local/php/bin/php -m

[PHP Modules]

bz2

Core

ctype

date

dom

ereg

exif

fileinfo

filter

gd

hash

iconv

json

libxml

mbstring

mcrypt

mysql

mysqli

openssl

pcre

PDO

pdo_mysql

pdo_sqlite

Phar

posix

Reflection

session

SimpleXML

soap

sockets

SPL

sqlite3

standard

tokenizer

xml

xmlreader

xmlwriter

zlib

[Zend Modules]

# 拷贝配置文件

[root@test-a php-5.6.32]# cp php.ini-production /usr/local/php/etc/php.ini

# 查看php信息

[root@test-a php-5.6.32]# /usr/local/php/bin/php -i

安装PHP7下载安装包解压[root@test-a src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2

[root@test-a src]# tar jxvf php-7.1.6.tar.bz2配置初始化[root@test-a src]# cd php-7.1.6/

[root@test-a php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

# 出错

....

checking for mysql_set_server_option in -lmysqlclient_r... no

configure: error: wrong mysql library version or lib not found. Check config.log for more information.

# 由于php已经带了这个模块,所以编译时不指定mysqli的路径,继续

[root@test-a php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

#出错

...

checking for mysql_commit in -lmysqlclient_r... (cached) no

configure: error: PDO_MYSQL configure failed, MySQL 4.1 needed. Please check config.log for more information.

#编译时不指定pdo的路径,继续

root@test-a php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql --with-mysqli --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

...

Thank you for using PHP.

config.status: creating php7.spec

config.status: creating main/build-defs.h

config.status: creating scripts/phpize

config.status: creating scripts/man1/phpize.1

config.status: creating scripts/php-config

config.status: creating scripts/man1/php-config.1

config.status: creating sapi/cli/php.1

config.status: creating sapi/cgi/php-cgi.1

config.status: creating ext/phar/phar.1

config.status: creating ext/phar/phar.phar.1

config.status: creating main/php_config.h

config.status: executing default commands编译安装[root@test-a php-7.1.6]# make

[root@test-a php-7.1.6]# make install

[root@test-a php-7.1.6]# ls /usr/local/apache2.4/modules/libphp*

/usr/local/apache2.4/modules/libphp5.so /usr/local/apache2.4/modules/libphp7.so

更多其他相关学习敬请关注PHP7教程栏目~

怎样安装php52-71,CentOS如何安装PHP5和PHP7相关推荐

  1. 编译安装php apache,CentOS编译安装Apache2.4+PHP5.6

    CentOS下YUM安装PHP和Apache是比较简单的,可是一般默认情况下的PHP版本是5.3,Apache版本是2.2.因为考虑到PHP版本和Apache版本越高性能越好,就打算在CentOS下编 ...

  2. linux安装f77编译器,CentOS下安装gcc /g++ /gfortran /g77 编译器

    完全新手入门的角度,学习CentOS..版本centos 6.2x86_64 由于手头有CentOS 6.2的安装光盘,所以采用的是rpm包来安装gcc编译器,这样免去来下载安装包的步骤..(其他的安 ...

  3. 平板安装python_在CentOS上安装Python3的三种方法

    Centos7默认自带了Python2.7版本,但是因为项目需要使用Python3.x你可以按照此文的三个方法进行安装. 注:本文示例安装版本为Python3.5, 一.Python源代码编译安装 安 ...

  4. CentOS下安装Memcached,Linux下安装Memcached,centos下安装memcached,linux下安装memcached...

    摘要:最近在看<大型分布式网站架构设计与实践>这本书,把其中的学习过程记录一下,以便日后复习. 一:Memcached简单介绍和描述: Memcached 是一个高性能的分布式内存对象缓存 ...

  5. linux 5.5安装万兆网卡驱动,CentOS下安装网卡驱动

    前言 最近,一台机器从FreeBSD换为CentOS,一路安装顺利.完事之后发现,网卡没有启用,dmesg | grep eth 命令确定网卡没有驱动导致的.于是开始了一路艰辛的安装过程. 安装过程 ...

  6. centos linux 安装jq,在centos中安装jq时遇到问题

    rishabhjitani 17 centos jq 在centos上安装jq时,我遇到了一个问题.我运行了以下命令: yum groupinstall "Development Tools ...

  7. linux温度监控控件下载安装,Linux_在CentOS上安装Sensors主机温度监控程序,先下载lm_sensors和sensors-applet两 - phpStudy...

    在CentOS上安装Sensors主机温度监控程序 先下载lm_sensors和sensors-applet两个程序. 其中,lm_sensors找到了rpm包文件:lm_sensors-3.0.1- ...

  8. 百度安装php环境,Centos下安装类百度文库环境

    使用php实现百度文库功能,网上搜索到的方案,实现doc转pdf,pdf转swf,然后显示出来. 这里简单的记录下,[doc转pdf,pdf转swf]两个功能的搭建流程. doc转pdf 使用到下列程 ...

  9. redhat 7.4 安装php,在 CentOS 中安装 PHP 7.4 的方法

    本指南提供了在 CentOS 8 / RHEL 8 Linux 系统上安装 PHP 7.4 的步骤.有兴趣的开发者已经可以在生产环境中使用使用 PHP 7.4,正式版本的官方发布时间为 2019 年 ...

  10. linux 安装go编译器,CentOS 7 安装 go 语言开发环境

    安装 VSCode 编辑器 安装 golang 安装 使用系统包管理工具安装:sudo yum install golang 查看安装到哪个目录:rpm -ql golang |more 测试安装是否 ...

最新文章

  1. 手机游戏繁荣时代,团队的N条死路
  2. MIT与TI研究人员已打造出新型防黑RFID芯片
  3. python pywin32 微信_Pywin32错误地安装进Anaconda的Python里了
  4. VTK:绘图之SurfacePlot
  5. oracle 之 基础操作
  6. 诗与远方:无题(九十二)
  7. asp.net免费网站三剑客:WebMatrix + MojoPortal + SQLCE
  8. c语言枚举法在单片机的应用领域,当前单片机主要应用在哪些领域?
  9. vc++键盘钩子和鼠标钩子
  10. 笔记本计算机摄像头怎么打开,手把手教你笔记本内置摄像头打不开解决方法
  11. request域中放入参数几种方法
  12. 360无线wifi路由器连接到服务器,luyou.360.cn如何登录360路由器
  13. 小程序怎么接入机器人客服系统
  14. iOS 真机调试 Bundle Identifier
  15. 使用PIL剪切图片和拼接图片
  16. 嵌入式应用层开发要学习什么
  17. GetAsyncKeyState函数中按键的信息
  18. Python绘制指数加权平均线
  19. linux操作系统基础北京邮电大学出版社,Linux操作系统与实训教程
  20. java签到功能的实现_java实现的签到系统

热门文章

  1. 《通过C#学Proto.Actor模型》之 HelloWorld
  2. spring cloud+dotnet core搭建微服务架构:配置中心(四)
  3. .NET的一点历史故事:擦肩而过的机遇
  4. Dapper源码学习和源码修改
  5. memcache在项目中的应用
  6. [转]浅析DDD(领域驱动设计)
  7. 【ArcGIS微课1000例】0005:空间连接(Spatial Join)
  8. linux shell之得到当前路径下的目录
  9. React Native之js调用Android原生使用Callback传递结果给js
  10. Android之屏幕旋转之后当前activity被finish了依然被拉起来