七、編譯安裝LAMP之apache與PHP整合

(1) 修改apache配置文件php

    cd /usr/local/apache/linux

    mkdir conf/apache

    vim httpd.confvim

在主配置文件<IfModule mime_module><\IfModule>之間插入行:app

    AddType application/x-httpd-php .phpide

添加apache用戶,修改User和Group爲:ip

    User apache文檔

    Group apacheit

    ServerName localhost:80io

    Include conf.d/*.conf

(2) 檢查

在默認的Apache根文檔目錄建立文件/usr/local/apache/htdocs/test.php,其內容爲:

    <?

    PHPinfo();

    ?>

    檢查是否有語法錯誤:/usr/local/apache/bin/apachectl –t

    編寫啓動腳本httpd放在/etc/init.d下

    啓動apache:service httpd start

    輸入:http://apache-ip/test.php 查看php所支持的模塊加載狀況。

(3)虛擬目錄

vim /usr/local/apache/conf.d/vhost.conf

NameVirtualHost *:80/

<VirtualHost *:80>

        DocumentRoot /home/linuxops/www/

        ServerName linuxops.com

</VirtualHost>

<Directory /home/linuxops/www/>

        Options FollowSymLinks

        AllowOverride None

        Order allow,deny

        Allow from all

</Directory>

相關文章
相關標籤/搜索