zoukankan      html  css  js  c++  java
  • 搭建PHP环境LAMP(Linux+Apache+MySQL+PHP)

     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配置安装成功!

  • 相关阅读:
    Microsoft Visual Studio 2008
    JavaScript动态添加|绑定事件
    超级实的js代码大全 [转]
    《dojo 边学边用》(02), djConfig配置解说
    整合ckeditor_3.0.1和ckfinder_aspnet_1.4.1.1,配置随笔记录
    everybody is a tourist。you and me。
    测试并提升你的jQuery选择器水平
    php
    《dojo 边学边用》(01), 初识dojo,dojo简介和框架概览
    HTML 三栏自动适应
  • 原文地址:https://www.cnblogs.com/tinyphp/p/5099658.html
Copyright © 2011-2022 走看看