ubuntu下apache+mysql+php安裝筆記

來源:互聯網
上載者:User

1. 安裝apache
$sudo apt-get install apache2
測試:
瀏覽器中輸入:http://192.168.21.133/
192.168.21.133為ubuntu IP

2. 安裝PHP
$ sudo apt-get install php5
$ sudo apt-get install libapache2-mod-php5
$ sudo /etc/init.d/apache2 restart

測試:sudo vim /var/www/test.php
vim輸入:

<html><body><?phpecho "Hello World";?></body></html>

在瀏覽器中輸入:http://192.168.21.133/test.php

瀏覽器中輸出hello world,表示安裝正確

3. 安裝mysql

$sudo apt-get install mysql-server
開啟外部存取許可權
$grant all privileges on *.* to root@"%" identified by"123456";  

$ sudo vi /etc/mysql/my.cnf

bind-address=127.0.0.1=> bind-address= 你機器的IP
或者注釋bind-address=127.0.0.1這行
這樣就可以允許其他機器訪問MySQL了

參考:http://wiki.ubuntu.org.cn/MySQL%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97

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

5.安裝phpmyadmin
$sudo apt-get install phpmyadmin
$sudo ln -s /usr/share/phpmyadmin /var/www/
使用:http://localhost/phpmyadmin/ 訪問

參考:http://www.linuxidc.com/Linux/2010-07/27230.htm

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.