linux apache2 php7,centos6.8安装php7 for Apache2

本文介绍了在Linux系统中如何在已安装Apache和MySQL的情况下,不更换它们而升级到PHP7。首先卸载旧版PHP,然后通过源码安装PHP7,包括配置选项如--with-apxs2等。在安装过程中,需要解决yum缺少apxs模块的问题,安装httpd-devel,并修改httpd.conf以支持PHP。最后,通过make和make install完成安装。
摘要由CSDN通过智能技术生成

运维开发网 https://www.qedev.com

2020-03-17 09:49

出处:网络作者:运维开发网整理

1,php for nginx就不用说了,我们的博客里面应该有写。2,直接源码安装,安装apache,安装php7,安装mysql。除了麻烦一点,应该没什么问题。3,yum的方式安装了apache和mysql,yum安装php7,这种方式也折腾了我一天

1,php for nginx就不用说了,我们的博客里面应该有写。 2,直接源码安装,安装apache,安装php7,安装mysql。除了麻烦一点,应该没什么问题。 3,yum的方式安装了apache和mysql,yum安装php7,这种方式也折腾了我一天。在windos下,我到是成功 实现了apache 下的多php版本切换,但Linux也已经安装的apache php mysql,突然想把php换成php7,但 yum又实现不了,虽然网上有人说更新yum源,但我试了是不行的。最后我就具体说说怎么不换apahce和mysql 的情况下,如何成功安装php7. 首先把已经安装的php,php-common卸载掉,yum remove xxx就可以。 然后下载php源码,解压,安装依赖,然后  ./configure --prefix=/usr/local/php7 \  --with-apxs2=/usr/sbin/apxs \  --with-curl \  --with-freetype-dir \  --with-gd \  --with-gettext \  --with-iconv-dir \  --with-kerberos \  --with-libdir=lib64 \  --with-libxml-dir \  --with-mysqli \  --with-openssl \  --with-pcre-regex \  --with-pdo-mysql \  --with-mcrypt \  --with-mhash \  --with-openssl \  --with-mysql-sock=/var/lib/mysql/mysql.sock \  --with-mysqli=shared,mysqlnd \  --with-pdo-sqlite \  --with-pear \  --with-png-dir \  --with-xmlrpc \  --with-xsl \  --with-zlib \  --enable-fpm \  --enable-bcmath \  --enable-libxml \  --enable-inline-optimization \  --enable-gd-native-ttf \  --enable-mbregex \  --enable-mbstring \  --enable-opcache \  --enable-pcntl \  --enable-shmop \  --enable-soap \  --enable-sockets \  --enable-sysvsem \  --enable-xml \  --enable-zip 最后,make make install就好了,就这么简单。 但在此之前需要解决几个问题: 1,yum 的apache没有apxs模块,也就安装php时的 --with-apxs2=/usr/sbin/apxs , 那么这个需要安装。网上说的yum install httpd-devel不行,建议这样, yum list httpd*先看看找找,然后yum install httpd-dev*。再whereis apax就发现 有了。全部安装完成之后,apache还不能支持php。第二步,找到httpd.conf文件, AddType  application/x-compress .Z AddType application/x-gzip .gz .tgz 在后面添加: AddType application/x-httpd-php .php(使Apcche支持PHP) 这样就可以了。然后 重启httpd就没问题了

分享到

0

0

0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值