Chinaunix首页 | 论坛 | 博客
  • 博客访问: 322025
  • 博文数量: 82
  • 博客积分: 1530
  • 博客等级: 上尉
  • 技术积分: 771
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-16 03:44
文章分类

全部博文(82)

文章存档

2011年(6)

2010年(76)

我的朋友

分类: 系统运维

2010-07-11 12:45:04

1、先从网上下载apache、php和mysql
   sudo apt-get install mysql-server
   sudo apt-get install apache
   sudo apt-get install php


2、apache遇到的各种问题
   1)sudo apache2 -k restart
   apache2: bad user name ${APACHE_RUN_USER}
首先确定文件/etc/apache2/envvar中的user和group都为www-data,修改后如下:
# envvars - default environment variables for apache3ctl
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
接着修改配置文件/etc/apache2/apache2.conf,将${APACHE_RUN_USER}和${APACHE_RUN_GROUP}全部改成www-data
2) sudo apache2 -k restart
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName httpd not running, trying to start (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs
问题在于,启动apache的命令都不对,应该输入:
sudo /etc/init.d/apache2 restart
2) sudo /etc/init.d/apache2 restart
* Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
结果这个问题,只要在配置文件/etc/apache2/apache2.conf中添加一句
Servername localhost


3、找不到网站的根目录
apache2在ubuntu下的配置文件好像和网上很多教程说的有点不一样。它的配置文件全部在文件夹/etc/apache2的目录下。主要的配置文件是apache2.conf而不是httpd.conf
apache2.conf里面会将这个文件夹下其他配置文件例如httpd.conf port.conf等等各种配置文件include进去。这时候去哪里找网站的根目录呢?
在文件夹/etc/apache2/site-available下,有一个配置文件default,里面显示网站的根目录是在/var/www
之前我一直想不到会在那里,以为那个文件夹主要是存放日志文件,而去文件夹/usr/share/apache2/default-site下寻找,结果悲剧了那么久。真是SB阿!


4、php无法连接数据库
整一个php的测试脚本
这个测试脚本出错,显示:

Fatal error: Call to undefined function mysql_connect()

php木有定义这个函数。
最简单的解决方法是直接下载php和mysql的关联包

sudo apt-get install php5-mysql


5、php的中文显示出现乱码
修改配置文件php.ini
改成:
default_charset = "UTF-8"
重启apache

问题解决!!!


阅读(2368) | 评论(0) | 转发(0) |
0

上一篇:卸载旧内核

下一篇:搭建mediawiki初体验

给主人留下些什么吧!~~