Ubuntu中使用apt-get安装LAMP
来源:互联网 发布:在职研修班网络班 编辑:程序博客网 时间:2024/05/11 02:27
本文重点介绍在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 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2016-04-15T18:00:57
上面信息说明Apache安装成功,通过浏览器访问Apache: http://localhost/
安装PHP7:
weirubo@weirubo-VirtualBox:~$ sudo apt-get install php7.0
查看PHP版本:
weirubo@weirubo-VirtualBox:~$ php7.0 -v
PHP 7.0.4-7ubuntu2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend 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
1# Conflicts: php51
1LoadModule php7_module /usr/lib/apache2/modules/libphp7.0.so1
上面信息说明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
2
echo phpinfo();
3
?>
使用浏览器访问:
http://localhost/phpinfo.php
- Ubuntu中使用apt-get安装LAMP
- Ubuntu中使用apt-get安装LAMP
- ubuntu环境安装lamp-apt-get安装
- ubuntu中使用apt-get安装zbar
- ubuntu下用apt-get安装lamp缺少mcrypt , curl
- ubuntu下用apt-get安装lamp缺少mcrypt 解决方法
- Ubuntu系统中使用apt-get安装Nginx服务器
- 在Ubuntu中使用apt-get安装nginx
- ubuntu10.04 使用apt-get 安装LAMP环境
- 使用apt-get方式安装LAMP包括phpmyadmin
- Ubuntu 使用apt-get安装nginx服务器
- ubuntu使用apt-get安装nginx
- ubuntu 16.04 使用apt-get安装jdk
- Debian(Ubuntu) 中apt-get使用
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get 搭建 LAMP 环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- Ubuntu 16.04 apt-get搭建LAMP环境
- CSS MASTERY Chapter 4 概要及感想
- Ubuntu安装go1.8
- 2017.11.08最新PLA1.2/PLA5.2.1被拒,官方审核人员解决方案
- TCP三次握手和四次握手
- CAN总线基础(二)——CAN总线物理层介绍(总线电压详解)
- Ubuntu中使用apt-get安装LAMP
- 大数据经典学习路线
- 错误 -5
- Ubuntu16 apt 安装mysql5.7
- pandas通过ix 索引
- 招聘单位对机器学习工作校招的要求总结
- bzoj1997 [Hnoi2010]Planar
- android UI
- Mariadb表操作的简单总结