Home php教程 php手册 安装Apache和PHP的一些补充,一篇很实用的文章

安装Apache和PHP的一些补充,一篇很实用的文章

Jun 13, 2016 am 10:13 AM
apache php and Install article use of

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

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

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.

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

See all articles