Home php教程 php手册 《PHP边学边教》(02.Apache+PHP环境配置上篇)

《PHP边学边教》(02.Apache+PHP环境配置上篇)

Jun 13, 2016 pm 12:35 PM
Small hint environment Related software Configuration

小提示:如果你还没有下载相关软件的话,请先去看开篇教程哦!

必 看:如果你已经装了IIS服务器,请到:“开始—> 程序 —> 管理工具 —> Internet 信息服务(IIS)管理器 —> 网站”将所有网站停止。否则将导致Apache无法启动。

上篇:安装Apache服务器


找到下载好的apache_2.2.3-win32-x86-no_ssl.msi文件,双击进行安装。

•Apache的安装界面•


(偷下懒,从网上找了几幅现成的图片用,呵呵)


第一步:不用说大家也知道,当然是点“Next”按钮咯。
第二步:点“I accept the terms…(同意协议)”然后再点“Next”按钮。
第三步:这时你会看到Apache服务器的说明,再点一次“Next”按钮。
第四步:终于看到一个需要输入东东的界面了,如下图:

上面三个输入筐依次为:域名、服务器名、管理员邮箱。因为我们是本地安装,所以这个爱填什么随你自己的口味去填咯。如果是真枪实弹的配服务器,那就要多注意下咯。第一个筐“Network Domain”域名信息,在这里填入你的服务器的域名,如果你已经申请到域名的话填入你申请的域名,(注意这里要填的是域名,只是你申请到的完整域名的后半部分,不包括"www"。如果你申请的是二级域名的话,就是第一个"."之后的部分)如果还没有的话,把本机的IP填上去就行了。下一个筐是服务器名,填入完整的域名或IP地址。再下一个筐是管理员Email地址。这三项在安装是就必须填写,但是在安装完成后你还可以随时进行修改,所以你不必担心填错了会出问题。最后的选项代表使用80端口还是8080端口,一般不需要改(我们用默认的80端口好了)。好了,说太多废话了,不理它,填完再点“Next”按钮。

第五步:到了这里有两个选项Typical(典型安装)和Custom(自定义安装),为节省时间,我们选择Typical,点“Next”按钮。

第六步:你将看到一个“Change…”按钮,你可以用它来更改Apache的安装目录,默认的安装目录是C:\Program Files\Apache Group 这个就随你喜欢了,默认也好,自己改个目录装也好,影响不大。为了讲解方便,我们这里用默认目录。点“Next”按钮。

第七步:准备安装,直接点“Install”按钮安装就可以了。
•Apache安装过程•


装完了点“Finish”按钮,完成安装。
OK,现在到你的开始菜单里点击:Apache HTTP Server 2.2.3—> Control Apache Server —> Start
这个步骤就是启动服务器了。

上天保佑,现在我们要开始测试安装是否成功了。打开浏览器,在地址里输入:http://localhost或者是http://127.0.0.1如果能看到下面的界面,那就表示安装成功了。否则……重新来过吧。祝你好运哦。

如果你安装成功了,那么就接着干吧。现在我们需要简单的配置一下Apache服务器,定位好PHP文件。一般放PHP的文件夹目录为C:\Program Files\Apache Group\Apache2\htdocs 我们来做个测试吧,写一个HTML文件,输入如下代码:
程序代码



Hello World

Hello World





将文件保存为“hello.htm”并复制到C:\Program Files\Apache Group\Apache2\htdocs目录下,打开浏览器,输入 http://localhost/hello.htm 就可以看见输出结果。也就是说htdocs夹是专门用来存放网站文件的,当然,我们也可以修改他,下面为了方便管理网站文件,就请大家和我一起来修改。

我们就假设要把网站文件都放在D:\PHProot目录下,那么就先去D盘建立PHProot文件夹,然后以记事本的方式打开C:\Program Files\Apache Group\Apache2\conf 目录下的httpd.conf文件,找到:
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"
将上行更换成下行:
DocumentRoot "D:/PHProot"

注意:这里的用的是斜杆“/”而不是“\” 谨防混淆。否则可能会出错。

再写一个HTML文件,代码如下:
程序代码



Oh Yeah

Oh Yeah





  将文件保存为“yeah.htm”并复制到D:\PHProot目录下,打开浏览器,输入 http://localhost/yeah.htm就可以看见输出结果。如果网页显示“Oh Yeah”则配置成功,那么,就祝大家好运咯。

总算把Apache的安装搞定了,在《Apache+PHP环境配置——中篇》里,我将详细介绍PHP的安装方法及配置方法。希望大家在这篇教程中有所收获。别忘了关注www.hetty.cn的最新教程哦。

——海霆 (Hetty)


点击下载此教程的world文档
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 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)

What should I do if Google Chrome prompts that the content of this tab is being shared? What should I do if Google Chrome prompts that the content of this tab is being shared? Mar 13, 2024 pm 05:00 PM

What should I do if Google Chrome prompts that the content of this tab is being shared? When we use Google Chrome to open a new tab, we sometimes encounter a prompt that the content of this tab is being shared. So what is going on? Let this site provide users with a detailed introduction to the problem of Google Chrome prompting that the content of this tab is being shared. Google Chrome prompts that the content of this tab is being shared. Solution: 1. Open Google Chrome. You can see three dots in the upper right corner of the browser "Customize and control Google Chrome". Click the icon with the mouse to change the icon. 2. After clicking, the menu window of Google Chrome will pop up below, and the mouse will move to "More Tools"

What software is crystaldiskmark? -How to use crystaldiskmark? What software is crystaldiskmark? -How to use crystaldiskmark? Mar 18, 2024 pm 02:58 PM

CrystalDiskMark is a small HDD benchmark tool for hard drives that quickly measures sequential and random read/write speeds. Next, let the editor introduce CrystalDiskMark to you and how to use crystaldiskmark~ 1. Introduction to CrystalDiskMark CrystalDiskMark is a widely used disk performance testing tool used to evaluate the read and write speed and performance of mechanical hard drives and solid-state drives (SSD). Random I/O performance. It is a free Windows application and provides a user-friendly interface and various test modes to evaluate different aspects of hard drive performance and is widely used in hardware reviews

CrystalDiskinfo usage tutorial-What software is CrystalDiskinfo? CrystalDiskinfo usage tutorial-What software is CrystalDiskinfo? Mar 18, 2024 pm 04:50 PM

CrystalDiskInfo is a software used to check computer hardware devices. In this software, we can check our own computer hardware, such as reading speed, transmission mode, interface, etc.! So in addition to these functions, how to use CrystalDiskInfo and what exactly is CrystalDiskInfo? Let me sort it out for you! 1. The Origin of CrystalDiskInfo As one of the three major components of a computer host, a solid-state drive is the storage medium of a computer and is responsible for computer data storage. A good solid-state drive can speed up file reading and affect consumer experience. When consumers receive new devices, they can use third-party software or other SSDs to

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to resolve an incompatible software attempt to load with Edge? How to resolve an incompatible software attempt to load with Edge? Mar 15, 2024 pm 01:34 PM

When we use the Edge browser, sometimes incompatible software attempts to be loaded together, so what is going on? Let this site carefully introduce to users how to solve the problem of trying to load incompatible software with Edge. How to solve an incompatible software trying to load with Edge Solution 1: Search IE in the start menu and access it directly with IE. Solution 2: Note: Modifying the registry may cause system failure, so operate with caution. Modify registry parameters. 1. Enter regedit during operation. 2. Find the path\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Micros

What software is photoshopcs5? -photoshopcs5 usage tutorial What software is photoshopcs5? -photoshopcs5 usage tutorial Mar 19, 2024 am 09:04 AM

PhotoshopCS is the abbreviation of Photoshop Creative Suite. It is a software produced by Adobe and is widely used in graphic design and image processing. As a novice learning PS, let me explain to you today what software photoshopcs5 is and how to use photoshopcs5. 1. What software is photoshop cs5? Adobe Photoshop CS5 Extended is ideal for professionals in film, video and multimedia fields, graphic and web designers who use 3D and animation, and professionals in engineering and scientific fields. Render a 3D image and merge it into a 2D composite image. Edit videos easily

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

What software is coreldraw - how to download the official free version of cdr2022? What software is coreldraw - how to download the official free version of cdr2022? Mar 18, 2024 pm 11:00 PM

CorelDRAW software is a vector graphics production tool software produced by Corel. It is mainly used for vector graphics, page design and image editing. Next, let the editor introduce to you what software coreldraw is? How to download the official free version of cdr2022! 1. What software is coreldraw? The origin of CorelDRAW. The full name of CorelDRAW software is CorelDRAW. It is a graphic design software for producing vector graphics. CorelDRAWX4 has been updated and optimized in text format, new interactive tables and page layer functions. CorelDRAWX4 supports online service integration and collaboration. As a graphic image tool and vector drawing software, it

See all articles