博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
11.10/11.11/11.12 安装PHP5 11.13 安装PHP7
阅读量:7207 次
发布时间:2019-06-29

本文共 3155 字,大约阅读时间需要 10 分钟。

hot3.png

安装php5

一.下载:

wget  http://cn2.php.net/distributions/php-5.4.45.tar.bz2

二.解压

tar -jxvf php-5.4.45.tar.bz2

三.配置编译参数:

[root@localhost src]# cd php-5.4.45[root@localhost php-5.4.45]# ./configure \--prefix=/usr/local/php \--with-apxs2=/usr/local/apache2/bin/apxs \--with-config-file-path=/usr/local/php/etc  \--with-mysql=/usr/local/mysql \--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 \--disable-ipv6

在这一步,遇到如下错误:

configure: error: xml2-config not found. Please check your libxml2 installation.

解决办法是:

yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel

还有错误:

configure: error: Cannot find OpenSSL's <evp.h>

解决办法是:

yum install -y openssl openssl-devel

错误:

checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution

解决办法:

yum install -y bzip2 bzip2-devel

错误:

configure: error: png.h not found.

解决办法:

yum install -y libpng libpng-devel

错误:

configure: error: freetype.h not found.

解决办法:

yum install -y freetype freetype-devel

错误:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决方法:

cd .. 退出当前目录

下载地三方源

wget  http://www.atomicorp.com/installers/atomicsh ./atomic    \\运行脚本

然后在安装3个依赖包

yum install php-mcrypt libmcrypt libmcrypt-devel
错误:
configure: error: jpeglib.h not found.
解决方法:
yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel -y

或者安装一个yum扩展包yum install -y epel-release

在重新编译一下 。

二:编译
#make
#eshop $?
三:编译安装
#makeinstall
#eshop $?

四:拷贝PHP的配置文件:

#cp/usr/local/src/php-5.4.36/php.ini-production /usr/local/php/etc/php.ini

下面是 编译时的一些参数

--with-apxs2=/usr/local/apache2/bin/apxs 这个工具是自动帮助我们安装扩展模块的,它会生成一个动态模块在apache2/modules

--with-mysql=/usr/local/mysql php也是依赖mysql的,所以要先安装mysql。apache然后在安装PHP;mysql和apache可以颠倒。

小技巧 /usr/local/php/bin/php 是执行文件 和 /usr/local/apache2/bin/apachectl 一样

/usr/local/php/bin/php -m 查看php模块

这些是静态模块;动态模块需要我们自己去编译


安装php7

• cd /usr/local/src/

• wget
• tar zxf php-7.1.6.tar.bz2
安装一个扩展源:yum install -y epel-release.noarch
如果没有包,yum install -y bzip2-devel libjpeg-turbo-devel libpng-devel freetype-devel libtomcrypt-devel openssl-devel php-mcrypt libmcrypt libmcrypt-devel gcc libtool-ltdl-devel expat-devel pcre-devel libxml2-devel libcurl-devel perl-Data-Dumper libaio bzip2

• cd 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 (--enable-pdo --enable-mysqlnd )这2个参数先暂时不加,需要研究
• make && make install
• ls /usr/local/apache2.4/modules/libphp7.so
• cp php.ini-production /usr/local/php7/etc/php.ini

转载于:https://my.oschina.net/u/3866516/blog/1921876

你可能感兴趣的文章
【转】 ASP.NET网站路径中~(波浪线)解释
查看>>
oracle根据Date字段查询区间数据(转)
查看>>
[C语言] 数据结构-算法效率的度量方法-事前分析估算方法
查看>>
js_实用
查看>>
基础权限管理
查看>>
navicat for mysql快捷键
查看>>
PHP中设置时区方法小结
查看>>
netty源码分析
查看>>
linux-2.6内核驱动学习——jz2440之输入子系统
查看>>
Sizeof与Strlen的区别与联系
查看>>
Hadoop- NameNode和Secondary NameNode元数据管理机制
查看>>
python中socket模块详解
查看>>
Android 四大组件 (三) BroadcastReceiver 介绍
查看>>
一个友盟BUG的思考和分析:Invalid update
查看>>
读取对象
查看>>
切换带空格的目录下
查看>>
Nginx 在ubuntu14.04下的安装
查看>>
51nod 1100:斜率最大
查看>>
简单工厂模式(C++)
查看>>
关于Java中的Arrays.copyOfRange()方法
查看>>