[LAMP]【转载】——PHP7.0的安装
2016-07-06 11:44
483 查看
***原文链接:http://my.oschina.net/sallency/blog/541287
php编译过程报错解决可参考:http://www.cnblogs.com/z-ping/archive/2012/06/18/2553929.html
安装 libmcrypt mhash mcrypt
CentOS 7 默认不包含这三个模块,所以得手动安装,注意mcrypt依赖前两者
libmcrypt-2.5.8.tar.gz
http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
mhash-0.9.9.tar.gz
http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
mcrypt-2.6.8.tar.gz
http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/
问题:configure: error: *** libmcrypt was not found
解决办法:
或者
php 编译安装
前几天试着装了一次,虽然最后也装好了但感觉乱乱的,在鸟哥的指导下才知道 mysql 扩展已经被 7.0 废除了,此后使用 mysqli pdo-mysql 并且推荐使用 php 自带的 mysqlnd 驱动 配置参数,并且 php-fpm 也已经被 php 纳入,直接在选项中开启即可,我在官网看 --enable-cgi 是默认配置且 --enable-fast-cgi 已经被废除,--enable-cgi 即可让 fpm 模式调用
ladp在64的系统里可能存在写库关联问题,执行下面的命令
部分参数释意
编译参数
注意的地方:
1:--enable-cgi --disable-cgi :
在 5.3.0后 enable-cgi 等同于--enable-fastcgi 也就是说此后不需要在额外声明 --enable-fastcgi,且 --enable-force-cgi-redirect 也默认有效且被废弃在编译选项中,要禁用需修改php.ini的cgi.force_redirect为0
2:--with-apxs2 --with-apache:
--with-apxs2是直接把php编译到apache的模块中去 --with-apache是置顶apache的serverRoot路径,生成apache的php模块 修改apache配置文件手动加载:
AddType application/x-httpd-php .php .html .htm
3:php7.0废除了--with-mysql编译选项,且推荐使用mysqlnd驱动
复制源码包中的 php.ini-development php.ini-production 至 php 安装目录下的 etc 中,或者放在系统的 /etc 下也可以
将 php 的 bin 和 sbin 加入环境变量
以下记录的的是我在libmcrypt mhash mcrypt三个模块安装中遇到的一些问题
# tar xf libmcrypt-2.5.8.tar.gz
# tar xf mcrypt-2.6.8.tar.gz
# tar xf mhash-0.9.9.9.tar.gz
# ./configure --prefix=/usr/local/libmcrypt
# make ; make install
# ./configure --prefix=/usr/local/mhash
# make ; make install
# ./configure --prefix=/usr/local/mcrypt
===>报错:configure: error: *** libmcrypt was not found
# ./configure --prefix=/usr/local/mcrypt --with-libiconv-prefix=/usr/local/libmcrypt/
===>还是报错:configure: error: *** libmcrypt was not found
为什么按照原文中的方法 # export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH我没有解决这个错误:
因为我在安装libmcrypt和mhash的时候,指定了安装目录,所以它们的“lib”是在各自的安装目录下(/usr/local/libmcrypt/lib、/usr/local/mhash/lib)而不是在/usr/local/lib下。
然后我试图将这些在“lib”复制到/usr/local/lib中,然后再编译:
# ./configure --prefix=/usr/local/mcrypt
没有出现这个错误了但出现了:
===>报错:configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/"
根据找到的方法:
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/inotify/lib
/usr/local/lib ------>在/etc/ld.so.conf中添加这一行
# ldconfig ------>然后再ldconfig(按找到的方法据说执行了这步就可以解决了)
ldconfig: /usr/local/lib/libmhash.so.2 不是符号连接
ldconfig: /usr/local/lib/libmcrypt.so.4 不是符号连接 <===但是我的出现了报错
对比了一下/usr/local/libmcrypt/lib、/usr/local/mhash/lib和我复制到/usr/local/lib下的文件,发现原来的确实存在着链接...
然后尝试:
# ln -sf libmcrypt.so.4 libmcrypt.so.4.4.8
# ln -sf libmhash.so.2 libmhash.so.2.0.1
再执行:
# ldconfig 没有报错了。
但是再编译,还是报错configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/" Pass......
php编译过程报错解决可参考:http://www.cnblogs.com/z-ping/archive/2012/06/18/2553929.html
安装 libmcrypt mhash mcrypt
CentOS 7 默认不包含这三个模块,所以得手动安装,注意mcrypt依赖前两者
libmcrypt-2.5.8.tar.gz
http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
mhash-0.9.9.tar.gz
http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
mcrypt-2.6.8.tar.gz
http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/
问题:configure: error: *** libmcrypt was not found
解决办法:
#export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
或者
# ldconfig
php 编译安装
前几天试着装了一次,虽然最后也装好了但感觉乱乱的,在鸟哥的指导下才知道 mysql 扩展已经被 7.0 废除了,此后使用 mysqli pdo-mysql 并且推荐使用 php 自带的 mysqlnd 驱动 配置参数,并且 php-fpm 也已经被 php 纳入,直接在选项中开启即可,我在官网看 --enable-cgi 是默认配置且 --enable-fast-cgi 已经被废除,--enable-cgi 即可让 fpm 模式调用
ladp在64的系统里可能存在写库关联问题,执行下面的命令
cp -frp /usr/lib64/libldap* /usr/lib/
部分参数释意
./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --with-mcrypt \ # mcrypt 加密算法 --with-mhash \ # mhash 加密算法 --with-mysqli=mysqlnd \ # 推荐使用 mysqlnd 驱动 mysql已被废弃 --with-pdo-mysql=mysqlnd \ # 推荐使用 mysqlnd 驱动 mysql已被废弃 --with-gd \ # gd库 --with-iconv \ --with-zlib \ --with-curl \ --with-jpeg-dir \ --with-freetype-dir \ --with-apxs2=/usr/bin/apxs \ # 让 php 直接编译到 apache 的模块中去 --with-apache=/etc/httpd \ # 静态编译apache的模块 编译完后去httpd.conf中加载so --with-openssl \ --with-xmlrpc \ --with-bz2 \ --with-gettext \ # 多语言应用开发 --with-readline \ # readline只能在linux下win使用stream_get_line --with-recode \ --with-ldap \ # 目录协议 --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-fpm \ # php-fpm 进程管理器 --enable-cgi \ # 默认开启php的cgi sapi --enable-xml \ --enable-bcmath \ --enable-inline-optimization \ --enable-mbregex \ --enable-mbstring \ --enable-ftp \ --enable-gd-native-ttf \ --enable-pcntl \ #pcntl 多进程扩展模块 --enable-sockets \ --enable-sysvmsg \ #消息队列 --enable-sysvshm \ #内存共享模块 linux --enable-shmop \ #内存共享模块 linux/windows --enable-zip \ --enable-soap \ --enable-session \ --enable-opcache \ # opcache 缓存优化 --enable-cli # cli 其实默认就是开启的 若禁用同时要--without-pear
编译参数
./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --with-mcrypt \ --with-mhash \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-gd \ --with-iconv \ --with-zlib \ --with-curl \ --with-jpeg-dir \ --with-freetype-dir \ --with-apxs2=/usr/bin/apxs \ --with-openssl \ --with-xmlrpc \ --with-bz2 \ --with-gettext \ --with-readline \ --with-recode \ --with-ldap \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-fpm \ --enable-cgi \ --enable-xml \ --enable-bcmath \ --enable-inline-optimization \ --enable-mbregex \ --enable-mbstring \ --enable-ftp \ --enable-gd-native-ttf \ --enable-pcntl \ --enable-sockets \ --enable-sysvmsg \ --enable-sysvshm \ --enable-shmop \ --enable-zip \ --enable-soap \ --enable-session \ --enable-opcache \ --enable-cli
注意的地方:
1:--enable-cgi --disable-cgi :
在 5.3.0后 enable-cgi 等同于--enable-fastcgi 也就是说此后不需要在额外声明 --enable-fastcgi,且 --enable-force-cgi-redirect 也默认有效且被废弃在编译选项中,要禁用需修改php.ini的cgi.force_redirect为0
2:--with-apxs2 --with-apache:
--with-apxs2是直接把php编译到apache的模块中去 --with-apache是置顶apache的serverRoot路径,生成apache的php模块 修改apache配置文件手动加载:
AddType application/x-httpd-php .php .html .htm
3:php7.0废除了--with-mysql编译选项,且推荐使用mysqlnd驱动
复制源码包中的 php.ini-development php.ini-production 至 php 安装目录下的 etc 中,或者放在系统的 /etc 下也可以
将 php 的 bin 和 sbin 加入环境变量
echo "export PATH=$PATH:/usr/local/php/bin:/usr/local/php/sbin" >> /etc/profile source profile
以下记录的的是我在libmcrypt mhash mcrypt三个模块安装中遇到的一些问题
# tar xf libmcrypt-2.5.8.tar.gz
# tar xf mcrypt-2.6.8.tar.gz
# tar xf mhash-0.9.9.9.tar.gz
# ./configure --prefix=/usr/local/libmcrypt
# make ; make install
# ./configure --prefix=/usr/local/mhash
# make ; make install
# ./configure --prefix=/usr/local/mcrypt
===>报错:configure: error: *** libmcrypt was not found
# ./configure --prefix=/usr/local/mcrypt --with-libiconv-prefix=/usr/local/libmcrypt/
===>还是报错:configure: error: *** libmcrypt was not found
为什么按照原文中的方法 # export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH我没有解决这个错误:
因为我在安装libmcrypt和mhash的时候,指定了安装目录,所以它们的“lib”是在各自的安装目录下(/usr/local/libmcrypt/lib、/usr/local/mhash/lib)而不是在/usr/local/lib下。
然后我试图将这些在“lib”复制到/usr/local/lib中,然后再编译:
# ./configure --prefix=/usr/local/mcrypt
没有出现这个错误了但出现了:
===>报错:configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/"
根据找到的方法:
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/inotify/lib
/usr/local/lib ------>在/etc/ld.so.conf中添加这一行
# ldconfig ------>然后再ldconfig(按找到的方法据说执行了这步就可以解决了)
ldconfig: /usr/local/lib/libmhash.so.2 不是符号连接
ldconfig: /usr/local/lib/libmcrypt.so.4 不是符号连接 <===但是我的出现了报错
对比了一下/usr/local/libmcrypt/lib、/usr/local/mhash/lib和我复制到/usr/local/lib下的文件,发现原来的确实存在着链接...
然后尝试:
# ln -sf libmcrypt.so.4 libmcrypt.so.4.4.8
# ln -sf libmhash.so.2 libmhash.so.2.0.1
再执行:
# ldconfig 没有报错了。
但是再编译,还是报错configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/" Pass......
相关文章推荐
- Yii 关联查询
- 随机颜色
- php 类中统一 调用方法处理
- php常用header头信息收藏
- 认识Composer
- DTP取上月
- 用phpStorm的数据库工具来管理你的数据库
- NTP服务器的搭建
- 如何在Webstorm/Phpstorm中设置连接FTP,并快速进行文件比较,上传下载,同步等操作
- PHP 递归创建目录
- PHP 获取 今日 本月 上月
- 什么是CGI、FastCGI、php-cgi、php-fpm?
- 关于PHP中的定时任务crontab详解
- .net FTP上传文件
- wget ftp
- php变量和对象销毁问题
- 时间服务器ntp
- 财付通支付接口完整源码实例php版
- php静态变量小结
- window下使用IIS搭建ftp服务器