linux(centos7)+apache+php7 安装教程

1 篇文章 0 订阅
1 篇文章 0 订阅

linux下apache和php7的安装

apache 的安装:


1:apache的下载

http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.18.tar.gz


2:解压

tar zvxf httpd-2.4.81.tar.gz 

cd httpd-2.2.21


3:配置安装目录和安装内容

./configure --prefix=/usr/local/apache --enable-so --enable-rewrite  (/usr/local/apache:安装目录)


4:编译安装

make && make install


5:启动apache

/usr/local/apache/bin/apachectl start


6:将apache加入到系统服务,用service命令来控制apache的启动和停止

首先以apachectl脚本为模板生成Apache服务控制脚本:

  grep -v "#" /usr/local/apache/bin/apachectl  > /etc/init.d/apache


用vi编辑Apache服务控制脚本/etc/init.d/apache:
  vi /etc/init.d/apache

在文件最前面插入下面的行,使其支持chkconfig命令:
  #!/bin/sh              
  # chkconfig: 2345 85 15              
  # description: Apache is a World Wide Web server.


保存后退出vi编辑器,执行下面的命令增加Apache服务控制脚本执行权限:    
  chmod  +x  /etc/init.d/apache

执行下面的命令将Apache服务加入到系统服务:    
  chkconfig --add apache


执行下面的命令检查Apache服务是否已经生效:    
  chkconfig --list apache              


命令输出类似下面的结果:              
  apache          0:off 1:off 2:on 3:on 4:on 5:on 6:off       


  表明apache服务已经生效,在2、3、4、5运行级别随系统启动而自动启动,以后可以使用service命令控制Apache的启动和停止。  


启动Apache服务:   service apache start   
停止Apache服务:        service apache stop   


php7的安装:


1:下载php7

http://cn2.php.net/get/php-7.0.4.tar.gz/from/this/mirror

2:解压

tar zxvf php-7.0.4.tar.gz

cd php-7.0.4

2:安装一些需要使用的库

yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel

3:配置安装的路径和安装的餐宿

./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mcrypt=/usr/include \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock \
--enable-mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir

5:编译 安装

make && make install






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值