11.10-11.12安装PHP5(上中下);11.13 安装PHP7

扩展:

php中mysql,mysqli,mysqlnd,pdo到底是什么 :

http://blog.csdn.net/u013785951/article/details/60876816

查看编译参数 :

http://ask.apelearn.com/question/1295

?PHP官网www.php.net

? 当前主流版本为5.6/7.1

先安装httpd再安装php!!!

11.10-11.12安装PHP5(上中下)

1. 进入下载安装包目录:

[[email protected] ~]# cd /usr/local/src

2. 下载php-5.6.30版本安装包:

[[email protected] src]# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

3. 解包解压php安装包:

[[email protected] src]# tar zxvf php-5.6.30.tar.gz

4. 进入php目录下:

[[email protected] src]# cd php-5.6.30

5. 编译php(报错要依照下面依赖包对应安装):

[[email protected] php-5.6.30]# ./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

配置详解:

--prefix=/usr/local/php(指定安装目录)

--with-apxs2=/usr/local/apache2.4/bin/apxs(工具作用:自动配置apache/httpd扩展模块)

--with-config-file-path=/usr/local/php/etc(指定配置文件所在路径)

--with-mysql=/usr/local/mysql(指定mysql库)

--with-pdo-mysql=/usr/local/mysql(指定pdo-mysql库)

--with-mysqli=/usr/local/mysql/bin/mysql_config(指定mysqli库)

其余的是指定php需要的模块。

6. 检验上一条命令执行是否有错?(数值0为没问题):

[[email protected] mariadb]# echo $?

7. 安装依赖包:

(编译php需要以下依赖包,编译后如图错误:安装对应依赖包后,再次编译!)

[[email protected] php-5.6.30]# yum install -y libxml2-devel

[[email protected] php-5.6.30]# yum install -y openssl-devel

[[email protected] php-5.6.30]# yum install -y bzip2-devel

[[email protected] php-5.6.30]# yum install -y libjpeg-devel

[[email protected] php-5.6.30]# yum install -y libpng-devel

[[email protected] php-5.6.30]# yum install -y freetype-devel

[[email protected] php-5.6.30]# yum install -y epel-release && yum install -y libmcrypt-devel

8. 编译php(需要安装以上依赖包):

[[email protected] php-5.6.30]# ./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

9. 执行 make :

[[email protected] php-5.6.30]# make

10. 执行 make install :

[[email protected] php-5.6.30]# make install

11. 拷贝当前目录下的配置文件(php.ini-production) ,到php目录下并重命名 :

[[email protected] php-5.6.30]# cp php.ini-production  /usr/local/php/etc/php.ini

11.13 安装PHP7

1. 进入下载安装包目录:

[[email protected] ~]# cd /usr/local/src

2. 下载php-7.1.6版本安装包:

[[email protected] src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2

3. 解包解压php安装包:

(安装bzip2安装工具:yum install -y bzip2)

[[email protected] src]# tar jxf php-7.1.6.tar.bz2

4. 进入php目录下:

[[email protected] src]# cd php-7.1.6

5. 编译php:

(5版本安装了编译需要的依赖包,7版本这里直接编译就可以)

[[email protected] src]# ./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

6. 执行 make :

[[email protected] php-7.1.6]# make

7. 执行 make install :

[[email protected] php-7.1.6]# make install

8. 安装了php5和php7,使用5或7版本需要更改配置文件:

[[email protected] php-7.1.6]# vim /usr/local/apache2.4/conf/httpd.conf

注意:禁掉不使用php7版本

不用哪个版本的php,就在对应行前 添加#,注释掉这行!!!

原文地址:http://blog.51cto.com/zhuneianxiang/2073879

时间: 2024-10-03 05:25:49

11.10-11.12安装PHP5(上中下);11.13 安装PHP7的相关文章

11.6 MariaDB安装;11.7 Apache安装(上)11.8 Apache安装(中)11.9 Apache安装(下)

11.6 MariaDB安装 1. 进入下载安装包目录: [[email protected] ~]# cd /usr/local/src 2. 下载mariadb安装包: [[email protected] src]# wget https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz 3. 解包

Oracle 11.2.0.1在xp上的静默(slient)安装

环境: XP SP3+Oracle 11.2.0.1 安装Oracle软件及数据库 先找到响应文件模版(一般在安装包的..\database\response下),进行编辑. 先复制一份原模版文件: E:\cry\SOFT\database>copy response/db_install.rsp db_install_cry.rsp response\dbca.rsp response\db_install.rsp response\db_install_cry.rsp response\ne

LAMP架构介绍;MySQL安装(上中下)

11.1 LAMP架构介绍 1. LAMP包含:Linux+Apache(httpd)+MySQl+PHP Linux : 操作系统(centos) Apache:httpd--外部服务软件 MySQl:存储数据软件(字符串) PHP : 脚本语言(以作网站为主) 2. Apache(httpd) , MySQl , PHP 这三个角色可以安装在同一台机器上,也可以分开使用.(注意:httpd 和 PHP 要在一起) 3. 11.2 MySQL_MariaDB介绍 1. 扩展: mysql5.5

11.10/11.11/11.12 安装PHP511.13安装PHP7

- 11.10/11.11/11.12 安装PHP5 - 11.13 安装PHP7 - 扩展 - php中mysql,mysqli,mysqlnd,pdo到底是什么 - http://blog.csdn.net/u013785951/article/details/60876816 - 查看编译参数 http://ask.apelearn.com/question/1295 # 11.10安装PHP5 上 -  PHP官网www.php.net -  当前主流版本为5.6/7.1  1.   c

nginx-1.11.10 download, install, start and stop

Environment:(CentOS 7) 1 [[email protected]_x1 nginx-1.11.10]$ uname -a 2 Linux netlab_x1 3.10.0-327.28.2.el7.x86_64 #1 SMP Wed Aug 3 11:11:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Download: 1 # download and uncompress 2 wget http://nginx.org/downl

CentOS 7 安装 php-5.6.20

一.安装环境:CentOS 7 Linux version 3.10.0-229.el7.x86_64 php-5.6.20 二.安装步骤: 2.1 安装php相关的依赖包 命令:yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel –y 2.2 下载php-5.6.20 命令:wget http://cn2.php.net/distributions/ph

11.10/11.11/11.12 安装PHP5 11.13 安装PHP7

11.10/11.11/11.12 安装PHP5根据提示完成安装,安装过程中会报错,按实际报错的需要安装我这安装出现这个错误:configure: error: mcrypt.h not found. Please reinstall libmcrypt.解决办法是安装这2个包:首行安装:yum install -y epel-release再安装:yum install -y libmcrypt-devel 因为这个包是依赖上一个包的查看加载的模块查看apache的配置文件输入/php5.so

11.6 MariaDB安装;11.7—11.9 Apache安装(上中下)

扩展: apache dso : https://yq.aliyun.com/articles/6298 apache apxs : http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/programs/apxs.html apache工作模式 : http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html 11.6 MariaDB安装 1. 进入下载安装包目录: [[emai

我的淘宝:Ubuntu 12.04.5上安装 Oracle 11.2.0.4 RAC

进入淘宝店铺 教程:Ubuntu 12.04.5上安装 Oracle 11.2.0.4 RAC 请支持下.价格好商量!