RedHat7安装PHP

建站服务器 1.操作系统版本

[root@aws srclib]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo) 2.下载php安装包,本例是5.6.30版本

cd /usr/local/src
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz 3.解压

tar -xzvf php-5.6.30.tar.gz 4.执行configure

cd 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-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 5.在configure过程中遇到6个错误,如下:

错误1:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决办法:
yum install -y libxml2-devel
错误2:
configure: error: Cannot find OpenSSL\'s
解决办法:
yum install -y openssl openssl-devel
错误3:
configure: error: Please reinstall the BZip2 distribution
解决办法:
yum install -y bzip2 bzip2-devel
错误4:
configure: error: jpeglib.h not found.
解决办法:
yum install -y libjpeg libjpeg-devel
错误5:
configure: error: freetype-config not found.
解决办法:
yum install -y freetype freetype-devel
错误6:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法:
yum install -y libmcrypt-devel 其中错误6,需要安装epel扩展yum源,安装方法如下:

rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm 6.上面的错误都解决后就可以编译和安装了

make
make install 7.最后复制文件

cp php.ini-production /usr/local/php/etc/php.ini
8.测试是否正确解析php

vi /usr/local/apache2.4/htdocs/mytest.php //写入如下内容

echo php测试正常
?>
9.保存脚本后继续测试,如下:

[root@aws srclib]# curl localhost/mytest.php



php测试正常 10.查看PHP配置文件所在位置

[root@aws srclib]# /usr/local/php/bin/php -i |grep -i loaded configuration file
PHP Warning: Unknown: It is not safe to rely on the system\'s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone \'UTC 欢迎访问我的另一篇文章,RedHat 7 安装httpd

http://blog.itpub.net/20893244/viewspace-2151184/


分享文章:RedHat7安装PHP
文章出自:http://bzwzjz.com/article/chsosg.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站建设公司 成都企业网站建设 成都网站设计 网站建设改版 网站设计制作报价 成都网站制作 成都定制网站建设 阿坝网站设计 成都商城网站制作 营销型网站建设 手机网站建设 成都网站建设 成都品牌网站设计 成都网站建设 网站建设公司 定制级高端网站建设 企业网站制作 网站建设方案 成都网站设计 网站设计 成都网站设计 高端网站设计