PHP环境配置

来源:互联网 发布:java第三方登录原理 编辑:程序博客网 时间:2024/06/15 09:43

一:安装apache

安装apache前需要的环境

下载apr和apr-util     here

下载pcre(注意,不要下成pcre2,否则会遇上各种问题)    here

解压到/usr/local/

安装:

1.apr:

./configure --prefix=/usr/local/apr

make

make install


2.apr-util

./configure --with-apr=/usr/local/apr --prefix=/usr/local/apr-util

make

make install


3.pcre

./configure --prefix=/usr/local/pcre

make

make install


下载apache

解压到/usr/local/

./configure --with-apr=/usr/local/apr/ --prefix=/usr/local/apache/ --with-apr-util=/usr/local/ --with-pcre=/usr/local/pcre

make

make install


其中,安装apr和apr-util有另外一种方法,就是直接解压到$(httpd)/srclib/下,其中$(httpd)表示解压apache后的路径,这种方法只需要解压即可,但需要注意,文件夹的命名就为apr和apr-util

参阅地址:addr1addr2 

二:安装php

安装libxml2,同样放到/usr/local/libxml2

make (install)

下载解压php

./configure --prefix=/usr/local/php --with-apx2=/usr/local/apache/bin/apxs --with-libxml2-dir=/usr/local/libxml2 --with-config-file-path=/usr/local/lib

make(install)   make test(wait too long.....)


三:整合PHP和Apache

修改apache配置文件:httpd.conf如下

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

LoadModule php5_module modules/libphp5.so

重启Apache 


0 0
原创粉丝点击