Ubuntu 16.04 apt-get搭建LAMP环境
来源:互联网 发布:java md5怎么解密 编辑:程序博客网 时间:2024/04/28 23:30
本文重点介绍在Ubuntu中使用apt-get安装LAMP(Ubuntu 16.04,Apache2.4.18,mysql5.7.12,php7.0.4)环境,所以不再介绍如何安装Ubuntu。
安装Apache:weirubo@weirubo-VirtualBox:~$ sudo apt-get install apache2
查看Apache版本:weirubo@weirubo-VirtualBox:~$ apache2 -vServer version: Apache/2.4.18 (Ubuntu)Server built: 2016-04-15T18:00:57
上面信息说明Apache安装成功,通过浏览器访问Apache:http://192.168.199.232/
安装PHP7:
weirubo@weirubo-VirtualBox:~$ sudo apt-get install php7.0
查看PHP版本:weirubo@weirubo-VirtualBox:~$ php7.0 -vPHP 7.0.4-7ubuntu2 (cli) ( NTS )Copyright (c) 1997-2016 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
上面信息说明PHP7安装成功。安装 libapache2-mod-php7.0:
weirubo@weirubo-VirtualBox:~$ sudo apt-get install libapache2-mod-php7.0
查看 libapache2-mod-php7.0是否安装成功:
weirubo@weirubo-VirtualBox:~$ cat /etc/apache2/mods-enabled/php7.0.load# Conflicts: php5LoadModule php7_module /usr/lib/apache2/modules/libphp7.0.so
上面信息说明 libapache2-mod-php7.0安装成功,并且php7成功加载模块libphp7.0.so安装MySQL:
weirubo@weirubo-VirtualBox:~$ sudo apt-get install mysql-server
安装过程中会要求设置root密码。安装php7.0-mysql:
weirubo@weirubo-VirtualBox:~$ sudo apt-get install php7.0-mysql
重启MySQL:weirubo@weirubo-VirtualBox:~$ sudo service mysql restart
重启Apache:weirubo@weirubo-VirtualBox:~$ sudo service apache2 restart
到此已完成LAMP环境搭建,我们来写一个php脚本测试是否apache可以解析php文件:新建一个php文件,phpinfo.php
weirubo@weirubo-VirtualBox:~$ sudo vim /var/www/html/phpinfo.php
输入php代码,保存并退出:
<?php echo phpinfo();?>
0 0
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get 搭建 LAMP 环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- ubuntu环境安装lamp-apt-get安装
- Ubuntu 16.04 LTS下用apt搭建LAMP环境
- Ubuntu 16.04搭建lamp环境
- Ubuntu中使用apt-get安装LAMP
- LeetCode 88 --- Merge Sorted Array
- vs2015编译慢的解决办法
- 图的广度优先搜索遍历
- WEB开发使用AD域用户名和密码登录
- EDirect: Command Line Access to NCBI
- Ubuntu 16.04 apt-get搭建LAMP环境
- 2.21.3 随机数统计个位上的数字
- 箱子_线段树
- 编译weex_v8core
- c++ 创建动态二维数组
- Android JNI C++遍历应用App私有文件夹,总是失败,Java才能成功
- 软件著作权查询
- 【杂】长连接短连接,各种“工”
- C++基础 一