LAMP全安裝詳解

來源:互聯網
上載者:User

我安裝的是Ubuntu 9.10的,通過新得立軟體包管理工具,通過任務分類選擇LAMP,然後選擇安裝,在瀏覽器中輸入 http://localhost,就可以看到


It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.


意味著PHP的系統已經安裝好了。

接下來看看如何配置apache伺服器。

(1) 先配置主檔案目錄,在/etc/apache2/sites-available目錄下,通過sudo gedit httpd.conf,

<VirtualHost *:80>
    ServerAdmin xujie19841206@hotmail.com
#加上indexes就可以讓任何目錄下的所有檔案展現出來
    DocumentRoot /home/xujie/www
    <Directory />
        Options indexes FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /home/xujie/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

...


就可以在我的主目錄/home/xujie/www下建立index.html,或者index.php。


(2) 接下來編輯/etc/apache2/apache2.conf中的檔案,是伺服器的設定檔,添加

# 使得能夠識別首頁目錄
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>


#使得能夠啟用PHP
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


然後開啟/etc/apache2/httpd.conf檔案,添加

LoadModule php5_module /usr/lib/apache2/module/libphp5.so


(3) 編輯/etc/php5/apache2/php.ini檔案,它是PHP的主設定檔,加上extension=mysql.so,就可以支援MySQL資料庫了。


(4)在 /home/xujie/www目 錄下,建立index.php檔案,然後在瀏覽器中輸入http://localhost/index.php,就可以看到PHP的配置結果頁面了。


(5)當然需要伺服器的重新起來,輸入 sudo /etc/init.d/apache2 restart就可以了。

 

現在開始安裝Zend Framework,方法如下:

(1)輸入:sudo apt-get install zend-framework,然後會看到需要消耗60M左右的空間的提示,選擇Y,就OK了。

(2)在/etc/php5/apache2/php.ini目錄下,把

#include_path:去掉注釋,然後把include_path = ".:/usr/share/php改為:include_path = ".:/usr/share/php/libzend-framework-php/:/usr/share/php",就可以載入ZF架構了。

(3)然後輸入a2dismod,看看其中有沒有rewrite,預設是沒有,然後輸入sudo a2denmod rewrite,提示輸入密碼就安裝了rewrite。

(4)在/etc/apache2/sites-available/default檔案中所有的AllOverride行都修改為:AllowOverride All ,就可以了。

(5)伺服器重啟:sudo /etc/init.d/apache2 restart

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.