Ubuntu搭建LAMP环境
来源:互联网 发布:公章软件免费下载 编辑:程序博客网 时间:2024/05/17 17:56
LAMP搭建环境
安装过程
第一步 安装Apache2
sudo apt-get install apache2
第二步 安装PHP模块sudo apt-get install php5
第三步 安装Mysqlsudo apt-get install mysql-server
sudo apt-get install mysql-client
第四步 其他模块安装sudo apt-get install mysql-client
sudo apt-get install libapache2-mod-php5
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo apt-get install php5-gd
第五步 测试Apache是否正常工作sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo apt-get install php5-gd
打开浏览器,输入localhost,看看是否有It Works!网页展示。目录为/var/www
第六步 修改权限/var/wwwsudo chmod 777 /var/www
第七步 安装phpmyadminsudo apt-get install phpmyadmin
安装过程中选择apache2,点击确定。下一步选择是要配置数据库,并输入密码。
第八步 测试phpmyadmin安装过程中选择apache2,点击确定。下一步选择是要配置数据库,并输入密码。
sudo ln -s /usr/share/phpmyadmin /var/www
然后直接运行http://localhost/phpmyadmin,看有没有数据库管理软件出现。
然后直接运行http://localhost/phpmyadmin,看有没有数据库管理软件出现。
配置过程
第一步 启用mod_rewrite模块
sudo a2enmod rewrite
重启Apache服务器:sudo /etc/init.d/apache2 restart或者sudo service apache2 restart
第二步 设置Apache支持.htm .html .php重启Apache服务器:sudo /etc/init.d/apache2 restart或者sudo service apache2 restart
sudo gedit /etc/apache2/apache2.conf&
添加以下句子:AddType application/x-httpd-php .php .htm .html
第三步 测试php网页添加以下句子:AddType application/x-httpd-php .php .htm .html
编辑mysql_test.php代码如下:
<?php
<?php
$link = mysql_connect("localhost", "root", "password");
if(!$link)
if(!$link)
die('Could not connect: ' . mysql_error());
else
echo "Mysql 配置正确!";
mysql_close($link);
?>
访问 http://localhost/mysql_test.php 显示’Mysql 配置正确‘就代表配置正确。
第四步 第三步这里出现了乱码以后解决方法访问 http://localhost/mysql_test.php 显示’Mysql 配置正确‘就代表配置正确。
打开配置文件sudo gedit /etc/apache2/apache2.conf&
添加如下代码:AddDefaultCharset UTF-8
添加如下代码:AddDefaultCharset UTF-8
到此为止配置OK。
apache2重启错误:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
解决方法:
编辑下面这个httpd.conf文件,打开它并根据如下操作进行编辑:
- sudo gedit /etc/apache2/httpd.conf
默认的httpd.conf是个空文件,现在向里面加入如下内容:
- ServerName localhost
保存并退出。
最后重启服务器:
- sudo /etc/init.d/apache2 restart
0 0
- Ubuntu LAMP环境搭建
- Ubuntu 搭建LAMP环境
- Ubuntu搭建LAMP环境
- ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- ubuntu 环境lamp搭建
- Ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- LAMP环境搭建(Ubuntu
- Ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- ubuntu搭建lamp环境
- Ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- Ubuntu搭建LAMP环境
- Ubuntu LAMP 环境搭建
- 解决warning C4003: “min”宏的实参不足(datetime.h)
- iOS8 如何使用 iOS Auto Layout
- 黑马程序员-java基础之常用对象
- emacs config for my
- Android dip px 总结备忘
- Ubuntu搭建LAMP环境
- 库存查询SQL语句,用到的相关技术
- 快速排序算法
- 【SGU】103. Traffic Lights 最短路
- LVS中Netfiler的实现
- OpenCV运动检测跟踪(blob track)框架组成模块详解
- [Nginx]nginx的 CPU参数worker_processes和worker_cpu_affinity使用说明
- 2004 Efficient Graph-Based Image Segmentation(P. Felzenszwalb et al)读后感
- IOS学习笔记之十五:UITapGestureRecognizer的使用