现在的位置: 首页 > 综合 > 正文

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

2013年04月24日 ⁄ 综合 ⁄ 共 2086字 ⁄ 字号 评论关闭
文章目录

 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

抱歉!评论已关闭.