`
maker.chen
  • 浏览: 23917 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Ubuntu 配置Apache2+PHP+MySQL

    博客分类:
  • php
php 
阅读更多
原文http://www.ilehao.com/blog/2012/10/28/ubuntu-apache-php-mysql/

1.安装apache2.0
sudo apt-get install apache2 

当然你也可以用编译的方式安装apache2
apache:下载地址:http://httpd.apache.org/download.cgi#apache22
编译前准备:
sudo apt-get install build-essential,
不然会出现 checking for C compiler default output file name... configure: error: C compiler cannot create executables
sudo apt-get install zlib1g-dev
不然 会出现 checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
然后从官网上下载apache2,然后解压(tar -xzvf)编译 (configure / make / make install)
*.config, make and make install:
sudo ./configure --prefi=/usr/soft/apache2 --enable-rewrite=static --with-mpm=worker --enable-so --enable-proxy --enable-proxy-http --enable-deflate --enable-headers --enable-expires --with-included-apr
make
make install

安装后在浏览器中打开:
http://localhost/
或者http://127.0.0.1
如果出现It works!那证明OK了

2.安装PHP

依次在终端打开:
sudo apt-get install php5 //安装PHP5
sudo apt-get install libapache2-mod-php5 //配置APACHE+PHP
sudo /etc/init.d/apache2 restart //重启APACHE

测试:
打开
sudo  vi /var/www/testphp.php

然后随意输入点东西(我输入的是test)再保存。
然后在浏览器中输入http://127.0.0.1/testphp.php或者http://localhost/testphp.php
如果显示出你输入的东西即为成功

3.安装MYSQL
sudo apt-get install mysql-server

安装完成按提示设置root密码

4、让apache、php支持 mysql
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo /etc/init.d/apache2 restart

至此apache2+php+mysql的环境就完成了。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics