安装Apache和PHP的一些补充,一篇很实用的文章
Anywhere liuxiLzl@163.net
PHP的安装步骤,网上有很多资料,都非常详细。但是,由于Apache,PHP这类自由软件的安装并不象商业软件那样有一个友好的用户界面,许多网友又很少碰上这类东东,所以尽管旁边有一份安装资料,但还是碰上许多问题。我在国内许多关于Linux和php的论坛上,也注意到了不少网友总问相似的问题。因此,我把我所知道的这类问题的解决方法写出来,不对的地方,还请各位指出。
一、自由软件的安装,无论是在Win32还是在Linux,一般都有README,安装之前,仔细读一读,会有很多收获。
二、安装Apache
这一步应该比较简单,只要你记得设置httpd.conf里面的BindAddress、ServerName、DocumentRoot ,应该就可以看到熟悉的Apache图标了。BindAddress是指可以接听的IP地址,可以是*、IP地址,也可以是完整的域名。ServerName是主机名,如果没有域名,可以用IP。DocumentRoot为预设的首页位置。修改httpd.conf之后要记得重起Apache。
三、安装PHP
这一步问题比较多,归根结底就是两个原因,一个是PHP没有起作用,这是因为httpd.conf中关于PHP部分的设置有问题;另一个问题是PHP启动了,但运行PHP文件的时候有错误,这是因为php.ini没有设置好。
1、httpd.conf的设置
在win32下,这几行是不能少的
ScriptAlias /php "d:/php/php.exe"
Action application/x-httpd-php "/php"
AddType application/x-httpd-php .php .php3
前两行指出PHP脚本解释器的位置,第三行指出PHP脚本要解释的文件后缀。
如果不是PHP4而是PHP3,把"application/x-httpd-php" 改为 "......httpd-php3",切记。
前面两行如果没有设置好,将会出现下载或者在页面显示PHP文件的情况。
在Linux中,如果PHP以Apache模块方式运行,那么只添加第三行就可以了,但是在安装的时候就应该注意步骤了,必须先安装PHP,之后 configure Apache的时候,要加上 --activate-module={libphp4.a的路径},然后 make,make install ......

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

AI Hentai Generator
Generate AI Hentai for free.

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 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

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

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

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

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

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 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.

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
