zoukankan      html  css  js  c++  java
  • YUM方式安装LAMP

    本文介绍两种方法yum安装LAMP,

    方法1: 通过httpd的php模块方式安装LAMP

    方法2: 通过php-fpm方式安装LAMP

    安装环境:CentOS Linux release 7.5.1804

    方法1: 通过httpd的php模块方式安装LAMP

    安装程序包:

    # yum -y install httpd php php-mysql mariadb-server

    启动服务:

    # systemctl start mariadb

    # systemctl start httpd

    方法2: 通过php-fpm方式安装LAMP

    安装程序包:

    # yum -y install httpd php-fpm php-mysql mariadb-server

    修改httpd配置

    # vim /etc/httpd/conf/httpd.conf
    修该配置增加index.php字段
    <IfModule dir_module>
        DirectoryIndex index.php index.html
    </IfModule>
    
    在文件末尾新增下面5行配置
    IncludeOptional conf.d/*.conf
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    ProxyRequests Off
    ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9000/var/www/html/$1

    启动服务

    # systemctl start mariadb

    # systemctl start php-fpm

    # systemctl start httpd

    测试LAMP是否正常安装

    1、测试PHP连通性

    # vim /var/www/html/index.php
    <?php
           phpinfo();
    ?>
    
    访问主页进行测试

    2、测试PHP和mysql的连通性

    修改数据库root的密码
    # mysqladmin -uroot password "123456"
    
    修改index.php页面信息
    # vim /var/www/html/index.php
    <?php
      $link = mysql_connect('localhost','root','123456');
      if ($link)
        echo "Link to mysql success..";
      else
        echo "Link to mysql failure..";
      mysql_close();
    ?>
    
    访问主页进行测试mysql联通性
  • 相关阅读:
    paraview添加vector
    origin横纵坐标颠倒
    [转] python提取计算结果的最大最小值及其坐标
    康奈尔大学CFD课程
    anaconda多环境配置
    mfix的Negative gas density报错解决
    python基础补漏-01
    ssh 公钥登陆的问题
    多进程
    关于GIL
  • 原文地址:https://www.cnblogs.com/ysuwangqiang/p/11921794.html
Copyright © 2011-2022 走看看