7、编译安装LAMP之apache与PHP整合

(1) 修改apache配置文件

    cd /usr/local/apache/

    mkdir conf/

    vim httpd.conf

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

    AddType application/x-httpd-php .php

添加apache用户,修改User和Group为:

    User apache

    Group apache

    ServerName localhost:80

    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>




你可能感兴趣的:(7、编译安装LAMP之apache与PHP整合)