Home php教程 php手册 win7系统配置php+Apache+mysql环境的方法

win7系统配置php+Apache+mysql环境的方法

Jun 06, 2016 pm 07:46 PM
w Configuration

如何在win7系统下配置php环境呢,php+Apache+mysql都是在配置过程中必不可少的元素,下面通过本篇文章给大家介绍win7系统配置php+Apache+mysql环境的方法,感兴

B/S架构当下很流行,因为B/S架构有众多优点,例如:用户只需有浏览器就可使用,维护升级都比较方便,跨平台,等等。本文就讲讲Windows+Apache+PHP+Mysql的开发环境如何配置。

如何在win7系统下配置php环境呢,php+Apache+mysql都是在配置过程中必不可少的元素,php负责解析php代码,apache负责服务器端而mysql是数据交互的中转站。

那么如何将php+apache+mysql配置好呢,接下来我们看一下具体的方法,软件版本会改变所以需要自己因时制宜,随机应变。

第一步:

php-5.5.10-Win32-VC11-x64.zip 下载地址:

httpd-2.4.7-win64-VC11.zip 下载地址:

mysql-5.6.16-winx64.zip 下载地址:

第二步:

安装配置Apache2.4.7(httpd-2.4.7-win64-VC11.zip )

1、解压下载的安装包:httpd-2.4.7-win64-VC11.zip将其放到自己的安装目录(我的目录D:\phpEnv\Apache24)

win7系统配置php+Apache+mysql环境的方法

2.然后对http.conf(D:\phpEnv\Apache24\conf\http.conf)配置文件进行修改-使用记事本打开就行

     (1)修改ServerRoot Apache的根路径:

        (37行)ServerRoot"c:/Apache24"改成=>ServerRoot "D:/phpEnv/Apache24"

     (2)修改ServerName你的主机名称:

        如果此行不修改则启动apache 提示Starting httpd: AH00558

        (217行)ServerName :80将前面的#去掉,该属性在从命令行启动Apache时需要用到。

     (3)修改DocumentRoot Apache访问的主文件夹目录,就是php、html代码文件的位置。Apache默认的路径是在htdocs(D:\phpEnv\Apache24\htdocs)下面,里面会有个简单的入口文件index.html。这个路径可以自己进行修改,我这里将其配置在我自己新建的文件夹www(D:\phpEnv\www)下。

          (247行) DocumentRoot "c:/Apache24/htdocs"

       

改为=>

        DocumentRoot "D:\phpEnv\www"
       

    (4)修改入口文件配置:DirectoryIndex一般情况下我们都是以index.php、index.html、index.htm作为web项目的入口。Apache默认的入口只有index.html需要添加其他两个的支持,当然这个入口文件的设置可以根据自己的需要增减,如果要求比较严格的话可以只写一个index.php,这样在项目里面的入口就只能是index.php

        (274行) 

        DirectoryIndex index.html
      

改为=>

      
        DirectoryIndex  index.php index.htm index.html
       

   (5)设定serverscript的目录:

        (358行)ScriptAlias/cgi-bin/ "c:/Apache24/cgi-bin/"改为=> ScriptAlias/cgi-bin/ "D:/phpEnv/Apache24/cgi-bin"

  (6)(380行)

       
          AllowOverride None
          Options None
          Require all granted
       

改为=>

       
          AllowOverride None
          Options None
          Require all granted
       

3、接下来就可以启动Apache了

开始---运行,输入cmd,打开命令提示符。接着进入D:\phpEnv\Apache24\bin目录下回车httpd回车,如图所示.

没有报错的话就可以测试了(保持该命令窗口为打开的状态)。

    把Apache24\htdocs目录下的index.html放到D:\phpEnv\www目录下,用浏览器访问会出现“It works”那么就说明apache已经正确安装并启动了。也可以自己写一个简单的index.html文件也可以打开。

win7系统配置php+Apache+mysql环境的方法

4、将Apache加入到window服务启动项里面并设置成开机启动

先关闭httpd的服务(将命令窗口关闭即可)

重新打开一个新的命令窗口进入到D:\phpEnv\Apache24\bin目录下:

添加HTTP服务的命令是:httpd.exe -kinstall -n "servicename"  servicename是服务的名称,我添加的是:httpd.exe -k install -n "Apache24"命令成功后会有成功的提示,此时你可以在window服务启动项中看到Apache24这个服务

然后点击启动就可以了,如果不想设置成开机启动的话也可以将启动类型修改为手动。

如果要卸载这个服务的话,先要停止这个服务,然后输入httpd.exe -k uninstall -n "Apache24"卸载这个服务。

当然也可以通过D:\phpEnv\Apache24\bin下面的ApacheMonitor.exe来启动Apache这里就不多说了

如此Apache的配置就基本完成了。

 

win7系统配置php+Apache+mysql环境的方法

二、安装配置php5.5.10(php-5.5.10-Win32-VC11-x64.zip)

1、将下载的php-5.5.10-Win32-VC11-x64.zip  解压到安装目录下我的是(D:\phpEnv\php)

2、将目录下的php.ini-development文件复制一份并改名为php.ini他是php的配置文件

3、为Apache服务添加php支持

打开Apache的配置文件http.conf在最后加上

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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
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)

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

How to set up Git configuration in PyCharm How to set up Git configuration in PyCharm Feb 20, 2024 am 09:47 AM

Title: How to correctly configure Git in PyCharm In modern software development, the version control system is a very important tool, and Git, as one of the popular version control systems, provides developers with powerful functions and flexible operations. As a powerful Python integrated development environment, PyCharm comes with support for Git, allowing developers to manage code versions more conveniently. This article will introduce how to correctly configure Git in PyCharm to facilitate better development during the development process.

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps Feb 21, 2024 pm 12:00 PM

PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

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

Avoid common mistakes in Maven environment configuration: Solve configuration problems Avoid common mistakes in Maven environment configuration: Solve configuration problems Feb 19, 2024 pm 04:56 PM

Maven is a Java project management and build tool that is widely used in the development of Java projects. In the process of using Maven to build projects, you often encounter some common environment configuration problems. This article will answer these common questions and provide specific code examples to help readers avoid common configuration errors. 1. Maven environment variables are incorrectly configured. Problem description: When using Maven, if the environment variables are incorrectly configured, Maven may not work properly. Solution: Make sure

Simple and easy-to-understand PyCharm configuration Git tutorial Simple and easy-to-understand PyCharm configuration Git tutorial Feb 20, 2024 am 08:28 AM

PyCharm is a commonly used integrated development environment (IDE). In daily development, using Git to manage code is essential. This article will introduce how to configure Git in PyCharm and use Git for code management, with specific code examples. Step 1: Install Git First, make sure Git is installed on your computer. If it is not installed, you can go to [Git official website](https://git-scm.com/) to download and install the latest version of Git

MyBatis Generator configuration parameter interpretation and best practices MyBatis Generator configuration parameter interpretation and best practices Feb 23, 2024 am 09:51 AM

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

See all articles