关于Apache 2.0和PHP5.0安装详解
随着时代的发展,php也在更新换代,我们这里就介绍一下PHP5.0安装,希望对喜爱PHP的朋友有帮助。假定你已经安装了Linux版本,而且它能够正确运行。请确信系统中已经安装一个可以运行的C语言编译器,否则我们的操作就不能进行。而且,还需要确定已经下载了所有相关软件:最新MySQL版本(即现在的MySQL 4.1.3测试版),可以从MySQL.com下载。最新的PHP版本(即现在的PHP 5.0.0),可从Php.net下载。最新的Apache 2版本(即现在的Apache 2.0.50),从Apache.org下载。
最重要的一点是:在这些版本中,Apache 2.0和PHP 5.0的结合并不是天衣无缝,所以不应该同时用于同一系统中。但是,这种结合应该对开发系统是有好处的。你可能还需要以下的支持库:最新版本的libxml2库(现在的libxml2 2.6.11),从XmlSoft.org下载。最新版本的zlib库(现在的zlib 1.2.1)从Gzip.org下载。把所有的东西都复制到你的/tmp子目录,并进行解压,如下所示:
<ol class="dp-xml"> <li class="alt"><span><span>$ cd /tmp </span></span></li> <li class=""><span>$ tar -xzvf mysql-standard-4.1.3-beta-pc-linux-i686.tar.gz </span></li> <li class="alt"><span>$ tar -xzvf php-5.0.0.tar.gz </span></li> <li class=""><span>$ tar -xzvf httpd-2.0.50.tar.gz </span></li> <li class="alt"><span>$ tar -xzvf libxml2-2.6.11.tar.gz </span></li> <li class=""><span>$ tar -xzvf zlib-1.2.1.tar.gz </span></li> </ol>
安装支持库
第一步,检查你是否安装了libxml2或者zlib。PHP5.0安装要求libxml2 2.6.0(或者是比libxml2 2.6.0更好的版本)和zlib 1.0.9(或者是比zlib 1.0.9更好的版本)。如果这两个支持库都没有,保持只读形式,否则进入下一部分。开始时,编译和安装libxml2 XML解析器,这一解析器提供PHP5.0安装新的XML APL:
<ol class="dp-xml"> <li class="alt"><span><span>$ cd /tmp/libxml2-2.6.11 $ ./configure </span></span></li> <li class=""><span>$ make && make install </span></li> </ol>
这一步结束时,libxml2被安装在/usr/local/下。如果你想把它安装在其它地方,你应该在先前步骤中明确指定prefix选项到configure设置中。
第二步:对zlib做类似的操作:
<ol class="dp-xml"> <li class="alt"><span><span>$ cd /tmp/zlib-1.2.1 $ ./configure </span></span></li> <li class=""><span>$ make && make install </span></li> </ol>
这一步结束时,zlib也被安装在/usr/local/下。你可以不使用默认值,而使用指定prefix选项将其安装到其它地方。
安装Apache
以Apache使用PHP有两种方式:作为动态模块,其在运行状态时可载入到Web服务器,或者作为静态模块,其可直接编译到Web服务器代码中。对于本文,我们着重于第一种方式。为了能以Apache2.0模块使PHP动态载入,Apache服务器必须以动态共享对象(DSO, Dynamic Shared Object)编译。可以通过传递--enable-so参数到Apache 2.0 configure使这一特性生效:
<ol class="dp-xml"> <li class="alt"><span><span>$ cd /tmp/httpd-2.0.50 </span></span></li> <li class=""> <span>$ ./configure </span><span class="attribute"><font color="#ff0000">--prefix</font></span><span>=/usr/local/apache2 --enable-so $ make </span> </li> <li class="alt"><span>&& make install </span></li> </ol>
这一过程将会设置,编译,以及将服务器安装到/usr/local/apache2。完成MySQL和Apache的安装之后,最后的一步即为编译和安装PHP。这一步骤中,最为关键的一步是使用一系列的激发扩展功能提供PHP configure,以及外部类库正确的文件路径。以上例子看起来相当复杂,然而事实并非如此:prefix设置PHP5 的安装路径。with-apxs2告诉PHP查找Apache 2.0的地方。with-libxml-dir和 --with-zlib-dir告诉PHP放置libxml2和zlib库的地方。with-mysql变量激活regularmySQL扩展功能。with-mysqli变量激活新增加的MySQL功能。with-gd变量激活 GD 扩展功能。with-zlib变量激活ZLIB 压缩库。enable-sockets变量激活socket通讯特性。enable-soap变量激活SOAP和Web services支持。
当然,也可以尝试其它选项和扩展功能:
<ol class="dp-xml"><li class="alt"><span><span>$ ./configure --help </span></span></li></ol>
一旦configure已经完成,你即可编译和安装PHP。
<ol class="dp-xml"> <li class="alt"><span><span>$ make </span></span></li> <li class=""><span> </span></li> <li class="alt"><span>$ make install </span></li> </ol>
可以注意到,这些安装过程能够自动将PHP模块安装在正确目录下,以便Apache 2.0的查找。

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

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

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