Home php教程 php手册 Apache, PHP在Windows 9x/NT下的安装与配置 (二)

Apache, PHP在Windows 9x/NT下的安装与配置 (二)

Jun 21, 2016 am 09:04 AM
apache conf localhost log windows

五、在Windows NT下运行Apache

如果你运行的Windows NT系统,你可能要将Apache作为系统的服务进程来运行。点击“开始”按钮,选择“程序”,“Apache Web Server”,“Insfall Apache as Service”。这样,你可以通过NT的控制面版中的“服务”程序来管理Apache的启动和终止。除非有特殊的理由,我建议你将“Apache Service”的运行方式改为“手动”:打开控制面版,选择“服务”图标,找到“Apache Service”,再点击“运行”,将运行方式设为“手动”。不过这样,当你要运行Apache时,必须亲自去启动它,虽然如此,在NT关闭时,Apache也会自动关闭,你不会看到任何Apache的窗口。

六、在Windows 9x中运行

如果你用的是Windows 9x,那么我建议你从作者的网站下载一份“Apache Manager for Windows”。它运行时停留在而右下方小图标栏中,并且会隐藏Apache创建的控制台窗口。这个程序让你避开讨厌的命令行直接启动、停止、重新启动Apache。如果你不用“Apache Manager”,你应通过选择“开始”,“程序”,“Apache webserver”及“Apache Server”来启动Apache,这样会创建一个控制台窗口。千万别关闭这个窗口,如果关掉,Apache就停止了。要停止Apache的运行,你要打开一个MS-Dos窗口,换到你的安装Apache的目录中,执行如下命令: apache -k shutdown Apache要花一点时间来关闭它的控制台窗口。这主要是为了确保卸载所有的进程,关闭所有的.conf和.log文件。这也正是作者编写Apache Manager的原因。

七、测试你的系统

我强烈建议你至少通过控制台窗口运行Apache一次。要想得到Apache的运行时显示信息的办法是通过控制窗口或error.log文件。error.log文件存放在Apache安装目录的log子目录内。如 c:\Apache\log\error.log。 好,从“开始”,“程序”,“Apache Webserver”中选择“Apache server”运行Apache,如果一切都ok的话,你应该能看到像下面的信息:

Apache/1.3.9(Win32) running...

如果你未能看到这条消息或Apache窗口稍纵即逝,你就必须从Dos窗口以命令行的方式启动Apache。换到你安装Apache的目录,键入"Apache",看看显示了什么消息。如果是“parse error in the conf file”,问题可能出在你的httpd.conf上。检查一下,并修正错误。

所有的都开始正常工作了。要测试你的系统,找开浏览器,输入如下地址:http://localhost/,你会看到一个由Apache显示给你的页面,上面写着“It works”之类的话。如果未出现这一页,可能你的TCP/IP配置有问题,将你的Windows目录里的hosts.sam文件复制为hosts文件,并检查是否有“127.0.0.1 localhost”一行,并且没有被注释掉。

接下来,试试PHP文件。用你喜爱的编输器,在APache安装目录下的htdocs子目录中创建一个名为info.php3的文件,内容如下:



再打开你的浏览器,输入如下地址:http://localhost/info.php3。如果没有问题的话,你会看到一张很长的表格,里面有PHP的各种配置信息及相关的环境变量,包括Apache的。如果它未工作,请检查你的httpd.conf的设置是否正确,这很重要。如果未设置好,Apache将不知道如何去处理.php3的文件。

八、使用目录别名(Directory Aliases)

你大可不必将所有的东西放到htdocs 目录中。为了能让Apache正确指到你想要的目录,你必须编辑httpd.conf文件,增加"Alias"指令。很简单,就像下面这样:

Alias /yoursite/ "c:path/to/your/web/site/"

重新启动Apache,你新建的目录就开始工作了。用你的浏览器打开http://localhost/yoursite/。当然,你完全可以用你喜欢的名字代替“yoursite”,然后在“c:\path\to\your\website”下面按照你的想法建立一个属于你自己的网站结构。




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
4 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
1673
14
PHP Tutorial
1277
29
C# Tutorial
1257
24
How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

git software installation git software installation Apr 17, 2025 am 11:57 AM

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! How to solve complex BelongsToThrough relationship problem in Laravel? Use Composer! Apr 17, 2025 pm 09:54 PM

In Laravel development, dealing with complex model relationships has always been a challenge, especially when it comes to multi-level BelongsToThrough relationships. Recently, I encountered this problem in a project dealing with a multi-level model relationship, where traditional HasManyThrough relationships fail to meet the needs, resulting in data queries becoming complex and inefficient. After some exploration, I found the library staudenmeir/belongs-to-through, which easily installed and solved my troubles through Composer.

vscode sets the header file path vscode sets the header file path Apr 15, 2025 pm 09:24 PM

To set the header file path in Visual Studio Code, open the User Settings panel, add the path in the Include Path field, and click the Save button. Example: { "includePath": ["/path/to/header1", "/path/to/header2"] }.

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.

What is git software for? How to use git software? What is git software for? How to use git software? Apr 17, 2025 pm 12:09 PM

Git is a distributed version control system designed to track code changes and allow collaborative development. It enables developers to document project evolution, manage code merges, and maintain project history in an efficient and secure way. Through Git's distributed architecture, each developer has a complete copy of the project and performs common version control operations without communicating with a central server.

git software installation tutorial git software installation tutorial Apr 17, 2025 pm 12:06 PM

Git Software Installation Guide: Visit the official Git website to download the installer for Windows, MacOS, or Linux. Run the installer and follow the prompts. Configure Git: Set username, email, and select a text editor. For Windows users, configure the Git Bash environment.

See all articles