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

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
3 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
1669
14
PHP Tutorial
1273
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.

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.

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.

Why does the Python script not be found when submitting a PyFlink job on YARN? Why does the Python script not be found when submitting a PyFlink job on YARN? Apr 19, 2025 pm 02:06 PM

Analysis of the reason why Python script cannot be found when submitting a PyFlink job on YARN When you try to submit a PyFlink job through YARN, you may encounter...

See all articles