linux 下安装php Apache mysql

20 篇文章 0 订阅

linux 下安装php Apache mysql


一、安装Apache

1.下载页面 https://httpd.apache.org/download.cgi#apache24

安装文件链接         http://apache.fayea.com//httpd/httpd-2.4.23.tar.gz

安装这个版本apache需要安装 APR   APR-Util PCRE 这几个依赖包

见安装说明:http://httpd.apache.org/docs/2.4/install.html

装好几依赖包后

解压httpd-2.4.23.tar.gz

tar -zxvf httpd-2.4.23.tar.gz

可用 ./configure --help 命令看配置安装项

 ./configure --prefix=http-PATH --with-apr=apr-PATH --with-apr-util=apr-util-PATH --with-pcre=pcre-PATH

指令说明

http-PATH  : 安装apache的目标文件夹,可以自己新建一个目标文件夹,放置安装的文件

apr-PATH : 安装apr的目录

apr-util-PATH : 安装apr-util的目录

pcre-PATH : 安装pcre的目录


接着执行

make 

make install   -- 该命令安装文件到指定的 http-PATH 目录


安装完apache后,修改配置文件 httpd.conf

添加

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps


修改

Require all granted
Allow from all


修改防火墙开80端口

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

/etc/rc.d/init.d/iptables save

/etc/init.d/iptables restart

查看

/etc/init.d/iptables status

vi /etc/sysconfig/iptables


启动apache

./apachectl start

停止

./apachectl stop


如有报错:

Server unable to read htaccess file, denying access to be safe

可参考解决

http://stackoverflow.com/questions/31365981/server-unable-to-read-htaccess-file-denying-access-to-be-safe


二、mysql安装


三、php安装

./configure  --prefix=php-PATH --with-mysql=mysql-DIR --with-apxs2=FILE 

FILE : apache安装文件里对应的apxs路径加文件名



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值