Home >php教程 >php手册 >让Apache支持PHP语言

让Apache支持PHP语言

WBOY
WBOYOriginal
2016-06-06 20:02:061151browse

下载PHP后解压安装包,例如PHP-5.2.13版本的,改名为PHP5.2,然后在PHP5.2中找到php.ini-dist复制一份然后命名为php.ini。在php.ini中需要修改几个地方 (1)设置扩展文件所在的目录; 在文件中找到extension_dir=./,将其更改名为extension_dir=c:/php5/ext

       下载PHP后解压安装包,例如PHP-5.2.13版本的,改名为PHP5.2,然后在PHP5.2中找到php.ini-dist复制一份然后命名为php.ini。在php.ini中需要修改几个地方

      (1)设置扩展文件所在的目录;

                   在文件中找到extension_dir="./",将其更改名为extension_dir="c:/php5/ext/"

       (2)开启常用的扩展

                       extension=php_bz2.dll

                      extension=php_gd2.dll
                      extension=php_mbstring.dll

                     extension=php_gettext.dll

                     extension=php_mysql.dll
                     extension=php_mysqli.dll

                     extension=php_pdo_mysql.dll

                    extension=php_sockets.dll

                    extension=php_xmlrpc.dll

 

 

     接下来编辑Apache的配置文件http.conf主要修改以下几个地方

    (1)加载用于处理PHP的模块 LoadModule php5_module "D:\Program Files\php5.4\php5apache2_2.dll"

     (2)在Apache中添加可识别的PHP的MIME类型

              AddType application/x-httpd-php .php

            AddType application/x-httpd-source .phps

    (3)加载libmcrypt.dll  和 libmysql.dll类库文件

             LoadFile c:/php5/libmcrypt.dll  

            LoadFile c:/php5/libmysql.dll

     (4)设置PHP的配置文件目录

                   PHPIniDir "c/php5.4"

至此PHP和Apache的结合必须的几项配置完毕,可以进行测试。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn