fedora 20安装httpd php mysql_Fedora 20下安装搭建LAMP环境Apache+MySQL+PHP

4 安装 PHP5

我们需要安装 PHP5 和 Apache PHP5 模块,运行命令:

yum install php

重启 Apache :

systemctl restart httpd.service

5 测试PHP5/获取关于PHP5安装详细信息

在默认根目录下创建一个探针文件:

vi /var/www/html/info.php

phpinfo();

?>

打开浏览器访问探针文件 (例如 http://192.168.0.100/info.php):

75968734143c5cbca8a577fd96e3c82b.png

正如你看到的,PHP5正在运行,再向下滚动,你会看到PHP5中已经启用了所有模块。 MySQL是没有被列入其中,这意味着现在还不支持MySQL。

6 让PHP5支持MySQL

我们需要安装一个模块使得php5支持mysql,先查询一下安装包

yum search php

使用下面的命令进行安装:

yum install php-mysqlnd php-mssql php-opcache

在重启Apache2:

systemctl restart httpd.service

现在刷新 http://192.168.0.100/info.php模块是否安装成功,看PHP5是否已经支持Mysql。

f17ca8e910893c5614bc5c8762c9ccae.png

7 安装phpMyAdmin来管理Mysql

phpmyadmin是一款基于php语言编写的管理 MySQL数据库的图形化软件。

使用下面的命令安装phpMyAdmin:

yum install phpmyadmin

现在配置 phpMyAdmin。我们需要改变 Apache 配置来让 phpMyAdmin 支持 localhost 连接(去掉/usr/share/phpMyAdmin/前面的注释,这样就准许访问)

vi /etc/httpd/conf.d/phpMyAdmin.conf

# phpMyAdmin - Web based MySQL browser written in php

#

# Allows only localhost by default

#

# But allowing phpMyAdmin to anyone other than localhost should be considered

# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin

Alias /phpmyadmin /usr/share/phpMyAdmin

#

# # Apache 2.4

#

# Require ip 127.0.0.1

# Require ip ::1

#

#

#

# # Apache 2.2

# Order Deny,Allow

# Deny from All

# Allow from 127.0.0.1

# Allow from ::1

#

Require all granted

# Apache 2.4

Require ip 127.0.0.1

Require ip ::1

# Apache 2.2

Order Deny,Allow

Deny from All

Allow from 127.0.0.1

Allow from ::1

# These directories do not require access over HTTP - taken from the original

# phpMyAdmin upstream tarball

#

Order Deny,Allow

Deny from All

Allow from None

Order Deny,Allow

Deny from All

Allow from None

Order Deny,Allow

Deny from All

Allow from None

# This configuration prevents mod_security at phpMyAdmin directories from

# filtering SQL etc. This may break your mod_security implementation.

#

#

#

# SecRuleInheritance Off

#

#

重启Apache:

systemctl restart httpd.service

访问phpMyAdmin输入地址 http://192.168.0.100/phpmyadmin/:

fa82ca5e587649519995ba1fd6f86471.png

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值