• Ubuntu_16.04_Lamp


    Ubuntu_16.04安装Lamp开发环境

     

    目录

    • 安装Apache2

    • 安装php5

    • 安装mysql-server

    • 安装php5-mysqlphp使用mysql服务,包括mysqlmysqlimysql_pdo等)

    • 安装php5-gd(安装方法同上)

    • 安装数据库图形软件WorkBench


    # 以上软件安装,默认版本为后标数字版本的最新版本(如Apache2,将会安装2版本的最新发布版本2.*)。

    # 同时,ubuntu将会自动安装相关依赖组件,不需要手动进行安装。

    # 如果某软件无法安装,请更换软件源进行安装。

    # 根据源的好坏,安装的简易程度也不同,有的源会把相应的组件打包好,有的则不会。



    开始安装

    1. Apache2


    命令:sudo apt install apache2


    验证是否成功:sudo apache2 -v


    ---

    Server version: Apache/2.4.12 (Ubuntu)

    Server built: Jul 24 2015 15:59:00

    ---




    2.php5


    命令:sudo apt install php5


    验证是否安装成功:sudo php5 -v


    ---

    PHP 5.6.11-1ubuntu3 (cli)

    Copyright (c) 1997-2015 The PHP Group

    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

    ---





    3.mysql-server


    命令:sudo apt install mysql-server


    验证是否安装成功:sudo mysql -u root -p


    ---

    Welcome to the MySQL monitor. Commands end with ; or g.

    Your MySQL connection id is 20

    Server version: 5.7.13-0ubuntu0.16.04.2 (Ubuntu)


    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


    Oracle is a registered trademark of Oracle Corporation and/or its

    affiliates. Other names may be trademarks of their respective

    owners.


    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.


    mysql>

    ---




    4. php5-mysql


    命令:sudo apt install php5-mysql


    提示:如果无法检测到源,请换源,并更新(sudo apt update),之后安装。


    重新启动apache服务器。


    验证是否安装成功:

    编写php文件:

    ---

    <?php

    echo 'Mysql:';

    $conn=mysql_connect('127.0.0.1', 'root', 'root');

    var_dump($conn);

    mysql_close($conn);


    echo "<hr>";


    echo "Mysql_Pdo:";

    $dbh = new PDO('mysql:host=127.0.0.1;dbname=mysql', 'root', 'root');

    var_dump($dbh);

    mysql_close($dbh);


    echo "<hr>";


    echo "Mysqli:";

    $mysqli = new mysqli('127.0.0.1', 'root', 'root', 'mysql');

    var_dump($mysqli);

    ---


    运行输出:

    ---

    Mysql:resource(1) of type (mysql link)


    Mysql_Pdo:object(PDO)#1 (0) { }


    Mysqli:object(mysqli)#2 (19) { ["affected_rows"]=> int(0) ["client_info"]=> string(6) "5.6.25" ["client_version"]=> int(50625) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(0) ["host_info"]=> string(20) "127.0.0.1 via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(23) "5.7.13-0ubuntu0.16.04.2" ["server_version"]=> int(50713) ["stat"]=> string(133) "Uptime: 9222 Threads: 2 Questions: 66 Slow queries: 0 Opens: 107 Flush tables: 1 Open tables: 26 Queries per second avg: 0.007" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(64) ["warning_count"]=> int(0) }

    ---





    5.WorkBench


    # 下载WorkBench软件,并使用命令安装。


    命令:sudo dpkg -i mysql-wrokbench-community-×××-.deb


    # 如果不成功,提示依赖问题。


    命令:sudo apt -f install


    # 重新输入安装。


    命令:sudo dpkg -i mysql-wrokbench-community-×××-.deb


    # 安装后,在bash中按照应用程序分类搜索workbench,点击图标进入软件。


    # 以上安装,如果有任何一个不成功,请换源重试。


    验证是否安装成功:

    ---

    双击打开软件:



     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    连接数据库:



     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    进入数据库:

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • 相关阅读:
    Kafka:主要参数详解(转)
    CXF:根据werservice代码生成WSDL(转)
    CentOS:ECDSA host key "ip地址" for has changed and you have requested strict checking(转)
    Oracle:一个用户操作多个表空间中表的问题(转)
    CentOS:设置系统级代理(转)
    Apache2.4:AH01630 client denied by server configuration
    Amabri:如何删除或停止指定的服务
    08 操作符相关
    07 Test结构
    06 退出 退出状态
  • 原文地址:https://www.cnblogs.com/KTblog/p/5740295.html
Copyright © 2020-2023  润新知