且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Centos系统下Lamp环境的快速搭建

更新时间:2021-09-07 13:20:51

  1. Centos系统下Lamp环境的快速搭建
  2.  

    yum安装过程,大概1-2分钟

    Centos系统下Lamp环境的快速搭建
    Centos系统下Lamp环境的快速搭建
  3.  

    启动apache服务并查看时候启动成功

    命令如下:(切记用root用户启动服务)

               启动:httpd start

               检测启动结果:ps aux | grep httpd

    Centos系统下Lamp环境的快速搭建
  4.  

    查看服务器的ip并进入网站根目录新建一个phpinfo.php的程序,用于查看php相关配置信息。

         

    Centos系统下Lamp环境的快速搭建
    Centos系统下Lamp环境的快速搭建
    Centos系统下Lamp环境的快速搭建
  5.  

    如果上述进展顺利,那我们接下来进行mysql数据库的配置

    命令如下:

     

                 启动:  /etc/rc.d/init.d/mysqld start

                 检查启动结果:  netstat -tulnp | grep :3306

                  修改root密码: mysqladmin -u root password ‘你想设置的密码’

    Centos系统下Lamp环境的快速搭建
  6.  

    进入mysql数据库,创建demo库和用于测试的person表,并插入测试数据

    Centos系统下Lamp环境的快速搭建
    Centos系统下Lamp环境的快速搭建
    Centos系统下Lamp环境的快速搭建
  7.  

    最后编写php连接mysql的测试代码,检测mysql是否能正常配合php工作

    Centos系统下Lamp环境的快速搭建
    Centos系统下Lamp环境的快速搭建
  8.