Home php教程 php手册 Apache 2.0.35 和 PHP 4.3-Dev 的集成

Apache 2.0.35 和 PHP 4.3-Dev 的集成

Jun 21, 2016 am 09:08 AM
apache enable php

apache

当 Apache 2.0.35 以正式版本发布时,发现网络上很少有提起能成功集成 Apache 2 和 PHP 4 的。就连著名的 PhpBuilder.com 上的论坛里也充满了消极的讨论。我是属于那种不敢气馁的家伙,昨天晚上工作到 2:00 AM 没有成果后,今天继续苦战,从晚上 9:00 到 0:00 基本有了眉目,但是由于 FreeLAMP.com 采用了 Zope+Fast_CGI 的组合和 Apache 集成,而 Fast_CGI 的 Apache 2 版本还在开发中,所以目前本网站运行的版本依然为 1.3.24。


编译 Apache 的命令是:

./configure --prefix=/apache2 --enable-auth-anon --enable-auth-dbm
--enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache
--enable-ext-filter --enable-proxy --enable-proxy-connect --enable-proxy-http
--enable-http --enable-dav --enable-rewrite --enable-so

我使用老套的 --enable-module=most --enable-shared=max 来编译时,发现并不能奏效, Apache 2 不会让安装的模块 most,所以采用了以上长长的一大串选项。

然后就是 make;make install ,看起来很成功。修改 httpd.conf ,把侦听端口修改为 1234 ,然后用 www.freelamp.com:1234 上去看看,不错,那个繁体版本的 index.html.big 出来了。(怎么没有我们大陆的简体版本呢?)

我知道要让 PHP 跑起来会十分的困难,所以,对于昨天搞到十分深夜,依然没有结果的下场,我并不感到悲哀。希望正在读此文的你,能很快部署起 Apache 2 和 PHP 4 的组合来。说实话,要安装 PHP ,必须先找到一个合适的 版本,现成的最新稳定版本是不能“组合”起来的。你必须去 snaps.php.net (这个网站有点慢!)下载 php4-latest.tar.bz2 ,然后才能用新版本编译。我使用了:

./configure --with-apxs2=/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-pgsql=/usr/local/pgsql

来开始,但是make 时发现系统报告:


00 -I/apache2/include -I/usr/local/src/php4-200204090000/Zend -I/usr/local/mysql/include/mysql -I/usr/local/pgsql/include -I/usr/local/src/php4-200204090000/ext/xml/expat -D_REENTRANT -I/usr/local/src/php4-200204090000/TSRM -g -O2 -pthread -DZTS -prefer-pic -c /usr/local/src/php4-200204090000/sapi/apache2filter/php_functions.c -o sapi/apache2filter/php_functions.lo
/usr/local/src/php4-200204090000/sapi/apache2filter/php_functions.c: In function `zif_apache_lookup_uri':
/usr/local/src/php4-200204090000/sapi/apache2filter/php_functions.c:91: parse error before `('
/usr/local/src/php4-200204090000/sapi/apache2filter/php_functions.c:92: parse error before `('
make: *** [sapi/apache2filter/php_functions.lo] Error 1
[root@www php4-200204090000]#

看来,其中一个程序的括号有问题,是 ADDLONG 的一个宏里面使用了 (long) 这样的定义,看来不是很有关系,就在 91 和 92 这两行里把这个 (long) 给去掉了。继续 make ,成功了!
然后,我不说,你也知道:make install 。

就这么简单!

不过,你需要在 httpd.conf 中加入下面的说明,以让 Apache 认识 .php 文件:

AddOutputFilter PHP .php
AddInputFilter PHP .php
AddType text/html .php

Apache 2 增加了很多新的特色,我在以前的文章就有过介绍。文章后面附加的连接,作为重要的参考资料对于您了解 Apache 2.0 的特色会有所帮助。本站将继续翻译/创作出有关 Apache 2.0 的文章来,就如我在论坛中所言,Apache 2.0 会成为一个重要的产品,研究提升价值。研究 Apache 2 也会提升本站的价值。我相信!



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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1672
14
PHP Tutorial
1277
29
C# Tutorial
1256
24
The Continued Use of PHP: Reasons for Its Endurance The Continued Use of PHP: Reasons for Its Endurance Apr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

The Compatibility of IIS and PHP: A Deep Dive The Compatibility of IIS and PHP: A Deep Dive Apr 22, 2025 am 12:01 AM

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

What happens if session_start() is called multiple times? What happens if session_start() is called multiple times? Apr 25, 2025 am 12:06 AM

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

NGINX and Apache: Understanding the Key Differences NGINX and Apache: Understanding the Key Differences Apr 26, 2025 am 12:01 AM

NGINX and Apache each have their own advantages and disadvantages, and the choice should be based on specific needs. 1.NGINX is suitable for high concurrency scenarios because of its asynchronous non-blocking architecture. 2. Apache is suitable for low-concurrency scenarios that require complex configurations, because of its modular design.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

Beyond the Hype: Assessing Apache's Current Role Beyond the Hype: Assessing Apache's Current Role Apr 21, 2025 am 12:14 AM

Apache remains important in today's technology ecosystem. 1) In the fields of web services and big data processing, ApacheHTTPServer, Kafka and Hadoop are still the first choice. 2) In the future, we need to pay attention to cloud nativeization, performance optimization and ecosystem simplification to maintain competitiveness.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

Using Laravel: Streamlining Web Development with PHP Using Laravel: Streamlining Web Development with PHP Apr 19, 2025 am 12:18 AM

Laravel optimizes the web development process including: 1. Use the routing system to manage the URL structure; 2. Use the Blade template engine to simplify view development; 3. Handle time-consuming tasks through queues; 4. Use EloquentORM to simplify database operations; 5. Follow best practices to improve code quality and maintainability.

See all articles