Ubuntu 9.04下配置Apache+PHP+Mysql+phpmyadmin

 1、安装 Apache2+ PHP+5MySQL+phpmyadmin
sudo apt-get install apache2 libapache2-mod-php 5 php 5 php 5-gd mysql-server php 5-mysql phpmyadmin


2、启用 mod_rewrite 模块
sudo a2enmod rewrite


3、重启apach

sudo /etc/init.d/apache2 restart

 

过程就是这么简单,比winXP下简单多了,记住下面几个命令和位置将会方便以后的操作:

 

sudo /etc/init.d/apache2 restart (重启 apache)
sudo gedit /etc/php 5/apache2/php .ini (配置 php .ini)
sudo gedit /etc/apache2/apache2.conf (配置 apache2.conf)
/var/www/(主目录位置)

 

在浏览中输入:http://localhost/

将出现“It works! ”这就表示配置成功了!

 

问题1:

phpmyadmin不能使用,这主要是因为phpmyadmin是默认安装在/usr/share/目录下的。

 

解决方法如下:

作个链接到 /var/www/ 目录下,命令为:

sudo ln -s /usr/share/phpmyadmin / /var/www/
再使用 http://localhost/phpmyadmin 即可以访问了。

 

问题2:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
这是一个 warning,出现在apache2启动 或重起时。主要是因为在配置 apache2 时,没有指定相应的主机名,即 ServerName。

 

解决方法如下:

sudo gedit /etc/apache2/httpd.conf ,

在最前加入 ServerName localhost:80 即可

 

 

问题3:设置其他文件夹到本地服务器中

Creating the Document Root Location

  1. Choose Places > Home Folder.
  2. From the context menu, choose Create Folder.
  3. Enter the name of the folder, for example, public_html.

Creating a New Virtual Host

  1. To launch the Terminal, choose Applications>Accessories>Terminal. The Terminal window opens.
  2. To copy the configuration file of the default virtual host to a new file (mysite ), type the following command at the command prompt:
    sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite
  3. Run the gedit application and edit the new configuration file (mysite ) in it:
    gksudo gedit /etc/apache2/sites-available/mysite 
    If asked, enter the password that you specified for the root user during the installation of your operating system.
  4. Change the Document Root to point to the new location:
    /home/<user>/public_html/
  5. Change the Directory directive, replace
    <Directory /var/www/>
    with
    <Directory /home/user/public_html/>
    Change Directory Root in Ubuntu
  6. Save the file mysite

Activating the New Virtual Host

  1. To deactivate the default host and activate the new host, launch the Terminal and run the following two utilities in the Terminal window:
    sudo a2dissite default && sudo a2ensite mysite
  2. Restart the Apache HTTP server:
    sudo /etc/init.d/apache2 restart

上面是我使用过程中遇到的问题,一些其他的问题见如下链接:

http://netbeans.org/kb/docs/php/configure-php-environment-ubuntu.html

http://hi.baidu.com/heiljsf/blog/item/7ade401b21000ddcac6e75d9.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值