Home php教程 php手册 关于Apache 2.0和PHP5.0安装详解

关于Apache 2.0和PHP5.0安装详解

Jun 13, 2016 am 11:04 AM
apache php about develop and Install us era of Detailed explanation along with

随着时代的发展,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>
Copy after login

安装支持库

第一步,检查你是否安装了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>
Copy after login

这一步结束时,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>
Copy after login

这一步结束时,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>
Copy after login

这一过程将会设置,编译,以及将服务器安装到/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>
Copy after login

一旦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>
Copy after login

可以注意到,这些安装过程能够自动将PHP模块安装在正确目录下,以便Apache 2.0的查找。


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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months 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)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

See all articles