免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1418 | 回复: 0
打印 上一主题 下一主题

Ubuntu中安装apache2、php5和mysql5 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-07 22:23 |只看该作者 |倒序浏览
环境:Ubuntu7.04
     网上还有分别下载安装包使用make、make install方法手动安装的,我也试过,但是出现了很多问题,主要是apache无法解析php文件,即用浏览器打开.php文件时弹出下载页面,按照网上的解决方法配置httpd.conf也无法解决此问题;另外还出现输入
http://localhost/
时显示的index.html不是./htdocs中的index.html,说明./htdocs并不是主目录位置,经查询得知,ubuntu默认的主目录是/var/www,解决方法是找到httpd.conf中

DirectoryIndex index.html
>
一三行注释掉。最终第二个问题解决,但是第一个问题始终找不到原因……

重新找了一个安装方法,简单方便~
1、安装 Apache2+PHP5+MySQL
  sudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd mysql-server php5-mysql phpmyadmin
2、启用 mod_rewrite 模块
  sudo a2enmod rewrite
3、配置 apache2.conf
  sudo gedit /etc/apache2/apache2.conf
  去掉 AddHandler cgi-script .cgi 前的注释 “#”
(如果没有则添加这句话)
  然后在任意地方添加这么一段:
   DocumentRoot /var/www/  
  Options FollowSymLinks
  AllowOverride all
  Options ExecCGI  
  重启服务器:
  sudo /etc/init.d/apache2 restart
注意:Php文件存放在/var/www中
     sudo /etc/init.d/apache2 restart (重启 apache)
   sudo gedit /etc/php5/apache2/php.ini (配置 php.ini)
   sudo gedit /etc/apache2/apache2.conf (配置 apache2.conf)


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/85048/showart_1921784.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP