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

  • 相关阅读:
    Saltstack
    搭建中小规模集群之rsync数据同步备份
    Python开发【第七篇】:面向对象二
    批量管理
    inotify
    Python开发【第六篇】:面向对象
    网络文件系统NFS
    Linux基础介绍【第九篇】
    Linux基础介绍【第八篇】
    Linux基础介绍【第七篇】
  • 原文地址:https://www.cnblogs.com/tinyphp/p/5099658.html
Copyright © 2020-2023  润新知