编译安装php

WBOY
Release: 2016-06-23 14:33:20
Original
776 people have browsed it

解压php- 到/usr/local/src下,进入该目录进行编译工作

cd /usr/local/src/php-5.2.9

#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php

注解:--with-apxs2=/usr/local/apache2/bin/apxs:用apache的apxs工具把php编译成apache的一个模块

--with-mysql=/usr/local/mysql:与mysql结合

make && make install

cp php.ini-dist /usr/local/php/php.ini

如果一切顺利的话,apache2/modules 下应该有个libphp5.so 的文件

为apache 添加php 支持

编辑/usr/local/apache2/conf/httpd.conf 文件

在AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

后面增加一行

AddType application/x-httpd-php  .php  (注意这个地方要有空格)

在DirectoryIndex指令的最后,添加 index.php

 

测试Apache及php支持

apache 的控制文件在 /usr/local/apache2/bin 下

apachectl stop 停止apache 服务

apachectl start 启动apache  服务

自行完成一个php 测试页1.php, 包含一行:

phpinfo() ?> ,放在下/usr/local/apache2/htdocs  

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template