• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

搭建PHP环境LAMP(Linux+Apache+MySQL+PHP)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

 1.安装Apache

yum -y install httpd 

用/etc/init.d/httpd start 启动apache 

apache默认的程序目录是/var/www/html

 

2.安装MySQL

yum -y install mysql mysql-server

用/etc/init.d/mysqld start 启动mysql

mysql_secure_installation 按回车提示设置mysql密码,直到显示“Thanks for using MySQL!”

 

3.安装PHP

yum -y install php 

 

4.启动设置

service httpd start  

service mysqld start  

配置httpd、mysqld开机自启动

chkconfig mysqld on 
chkconfig httpd on

 

5.测试

在/var/www/html/新建test.php

<?php
phpinfo();
?>

访问:localhost/test.php,显示正常则LAMP环境安装成功

 

 ============================================

 

6.为了便于从web上去管理MySQL,安装phpMyAdmin

yum -y install phpMyAdmin

 

配置phpMyAdmin

修改/etc/phpMyAdmin/config.inc.php

$cfg['Servers'][$i]['controluser']   = 'root';          // MySQL control user settings
                                                  // (this user must have read-only
$cfg['Servers'][$i]['controlpass']   = 'xxxxxx';          // access to the "mysql/user"
.....
$cfg['Servers'][$i]['user']          = 'root';          // MySQL user
$cfg['Servers'][$i]['password']      = 'xxxxxx';          // MySQL password (only needed

 

将phpMyAdmin的安装路径连接到httpd服务目录下

ln -s /usr/share/phpMyAdmin /var/www/phpMyAdmin

 

修改/etc/httpd/conf.d/phpMyAdmin.conf,把"Deny from All" 修改为"Allow from All"

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Allow from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

 

在浏览器地址栏中打开http://localhost/phpmyadmin

到此,phpmyadmin配置安装成功!


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP常用函数总结(180多个)发布时间:2022-07-10
下一篇:
php远程下载文件发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap