Table of Contents
PHP模块化安装教程,php模块化教程
Home php教程 php手册 PHP模块化安装教程,php模块化教程

PHP模块化安装教程,php模块化教程

Jun 13, 2016 am 08:38 AM
php Install Modular

PHP模块化安装教程,php模块化教程

本文讲述了PHP模块化安装的方法。分享给大家供大家参考,具体如下:

PHP(Hypertext Preprocessor)这门虽然简单但功能却是非常强大的脚本语言,下面就 基于WindowsXP+sp2的操作平台下的 Apache2.0.53+php5.2.1安装及基本配置过程记录下来以供参考:

一、首先从各官方网站下载以下程序:

1. apache_2.0.53-win32-x86-no_ssl.exe
2. php-5.2.1-Win32.zip (二进制压缩包)

二、安装及配置过程:

1. 安装apache Web 服务器:

双击安装文件apache_2.0.53-win32-x86-no_ssl.exe 将其安装在 D:/Apache目录下(本人在D盘新建了Apache文件夹)下,

-------------------------------------------------------
+ 注意:安装过程可能会出现以下问题:
+ OS 10048通常每个套接字地址 (协议/网络地址/端口) 只允许使用一次:
+ make_sock: could not bind to address 0.0.0.0:80...” 一般是IIS占用了80端口引起的
+ 两种解决方法:
+ 1、打开 控制面板->服务 找到 IIS admin 的服务 关闭并禁用
+ 2、如果不想关闭IIS服务 可将apache使用的端口改成其它端口
+ 将apache2/conf/httpd.conf 中的Listen 80 改为 Listen (你要使用的端口) 如 Listen 8080
+ 不过这时在你访问你的apache 下的Web服务时 在域名后要加上端口号
+ 如: http://localhost:8080
-------------------------------------------------------

测试Apache 是否安装成功,将在浏览器中输入:http://localhost:8080/http://localhost 如果能够看到Apache的标志羽毛,则Congratulations!!!

2. 安装PHP:

将 php-5.2.1-Win32.zip里内容解压到D:/PHP(本人在D盘新建了PHP文件夹)里,找到 php目录里的 php.ini-dist 重命名为 php.ini 并拷到 windows目录里。再将D:/PHP目录里的php5ts.dll,libmysql.dll拷贝到系统目录(windows/systems32 下)。

配置apache里的httpd.conf

打开 D:/Apache2/conf/httpd.conf 这个文件
找到 AddDefaultCharset ISO-8859-1 将其改为 AddDefaultCharset GB2312 (让默认语言编码为简体中文)
找到 DocumentRoot "D:/Apache2/htdocs" 将其改为你的WEB目录(可不改)如我的为 DocumentRoot "G:/Web Project"
找到 DirectoryIndex index.html index.html.var 在后面加入 index.htm index.php

选择安装模式: 模块化模式安装 或 CGI模式安装 (选一样即可)

模块化安装配置

找到 #LoadModule ssl_module modules/mod_ssl.so 这行,在此行后加入一行:

LoadModule php5_module d:/php/php5apache2.dll

Copy after login

其中d:/php/php5apache2.dll 为你php目录中php5apache2.dll所在的位置

注: LoadModule php5_module d:/php/php5apache2.dll
//注意:其中C:/php5/php5apache2.dll是你安装php的相应路径.不要把php5apache2.dll和 php5apache2 _2.dll混淆.

php5apache2.dll只适用于apache 2.0版本.

如 果是apache2.2.*或以上版本,就可能会出现 "Cannot load C:/php/php5apache2.dll into server: The specified module could not be found."或者:"The requested operation has failed"

找到 AddType application/x-gzip .gz .tgz 这行,在此行后加入一行

AddType application/x-httpd-php .php

Copy after login

CGI安装配置

找到 AddType application/x-gzip .gz .tgz 这行,加入如下即可:

ScriptAlias /php/ "d:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi.exe"

Copy after login

注: CGI英文全称是 Common Gateway Interface,通常翻译为共同网关接口,是HTTP服务器与机器上的其他程序进行通信的一个接口。这个“其他程序”可以使用任何计算机语言来编写, 它通过CGI这个接口从HTTP服务器取得输入,然后把运行的结果又通过CGI这个接口交给HTTP服务器,而HTTP服务器把这个结果送给浏览器。

CGI 的出现让WEB从静态变为为动态,随着Web的越来越普及,很多的网站的都需要有动态的页面,以便与浏览者互交。CGI方式的缺点也越来越突出。因为 HTTP要生成一个动态页面,系统就必须启动一个新的进程以运行CGI程序,不断地fork是一项很消耗时间和资源的工作。这就出现了FastCGI。

FastCGI 像是一个常驻 (long-live) 型的 CGI,它可以一直执行着,只要激活后,不会每次都要花费时间去 fork 一次 (这是 CGI 最为人诟病的 fork-and-execute 模式)。

此时PHP环境基本已经配置成功

在WEB根目录(如我的D:/website)里建一个名为test.php的文件内容如下

重新启动apache服务

用浏览器打开 http://localhost/test.php 或  在LINUX系统中:/usr/local/php/bin/php -f test.php

如果可以看到php配置输出信息就OK了

注: 模块化安装 mod_php 就是把PHP做为APACHE一个内置模块。让apache http 服务器本身能够支持PHP语言,不需要每一个请求就启动PHP解释器来解释PHP

更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP数学运算技巧总结》、《php操作office文档技巧总结(包括word,excel,access,ppt)》、《PHP数组(Array)操作技巧大全》、《php排序算法总结》、《PHP常用遍历算法与技巧总结》、《PHP数据结构与算法教程》、《php程序设计算法总结》、《php正则表达式用法总结》、《PHP运算与运算符用法总结》、《php字符串(string)用法总结》及《php常见数据库操作技巧汇总》

希望本文所述对大家PHP程序设计有所帮助。

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 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 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)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

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.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

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

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

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.

See all articles