- 论坛徽章:
- 59
|
本帖最后由 renxiao2003 于 2010-07-21 14:09 编辑
在Linux下,用源码安装时,php5.3.2还是支持原来的“Apache 2.0 Handler module”方式的。但在WINDOWS已经不支持这种方式了。本文安装的软件为:
1)Apache2.2.15:http://labs.renren.com/apache-mirror/httpd/httpd-2.2.15.tar.bz2
2)php5.3.2:http://www.php.net/get/php-5.3.2.tar.bz2/from/a/mirror
3)MySQL:非源码安装(使用- apt-get install mysql-server mysql-client libmysqlclient10-dev
复制代码 安装,在Ubuntu下;开发包必须安装,否则要使PHP支持MYSQL就会缺少头文件。)
1、安装Apache2.2.15
- tar -jxvf httpd-2.2.15.tar.bz2
- cd httpd-2.2.15
- /configure --prefix=/usr/local/apache --enable-module=so --enable-mods-shared=max
- make
- make install
复制代码 在configure时,如果输出config.status: executing default commands消息则正常结束。如有问题根据问题信息修改。
在make时,输出make[1]: Leaving directory `/tmp/httpd-2.2.15'则表示编译基本没有问题。
在make install时,输出Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache/man
mkdir /usr/local/apache/man/man1
mkdir /usr/local/apache/man/man8
mkdir /usr/local/apache/manual
make[1]: Leaving directory `/tmp/httpd-2.2.15' 则表示安装成功;
然后到/usr/local/apache/bin/httpd -k start启动,在浏览器输入网址http://localhost,输出“It works ”则表示APACHE服务已经正常启动。
2、安装PHP
- tar -jxvf php-5.3.2.tar.bz2
- cd php-5.3.2
- ./configure --prefix=/usr/local/php --with-mysql --with-config-file-path=/usr/local/php/etc --enable-fast-install --with-apxs2=/usr/local/apache/bin/apxs
- make
- make install
复制代码 在make install前,PHP建议执行make test进行测试。
在configure,得到输出信息+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
则证明正常,如果添加了configure不认识的参数,可能会在下面还有一些信息,但只要上面信息出现,配置基本就正常了。比如在如上信息出现:
Notice: Following unknown configure options were used:
--enable-zlib
Check './configure --help' for available options
就是使用了configure不认识的参数enable-zlib
make时,得到Build complete.
Don't forget to run 'make test'.
则编译正常。
然后是make install安装。
一般说来。在编译成功后,安装基本没有问题。
然后写个php文件放到/usr/local/apache/htdocs下,如在浏览器输入http://localhost/index.php,如果输出版本信息,则PHP安装成功。
注意:
我在安装PHP后,停止APACHE时,出现如下提示:httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: undefined symbol: zend_parse_parameters.
这是没有安装bison,如果是在ubuntu下,用apt-get install bison安装后,重新编译安装PHP。就正常。
重新安装命令如下:
- make distclean
- ./configure --prefix=/usr/local/php --with-mysql --with-config-file-path=/usr/local/php/etc --enable-fast-install --with-apxs2=/usr/local/apache/bin/apxs
- make
- make install
复制代码 看看你能成功吗?
编辑httpd.conf,在AddType application/x-gzip .gz .tgz后加上
AddType application/x-httpd-php .php
让APACHE解析PHP。 |
|