Apache2.0.35和PHP4.3-Dev的集成_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 也会提升本站的价值。我相信!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.
