Home php教程 php手册 Win7+IIS+PHP+MySql 配置

Win7+IIS+PHP+MySql 配置

Jun 06, 2016 pm 07:59 PM
http Configuration

http://blog.csdn.net/vanglen/article/details/8224683 ========================================================================================================================== 最近接触了一个PHPMySql的项目,由于之前也木有做过PHP,所以整理了

http://blog.csdn.net/vanglen/article/details/8224683

==========================================================================================================================

最近接触了一个PHP+MySql的项目,由于之前也木有做过PHP,所以整理了一下从官网和各位大虾的配置方法,并且记录如下。

 

资源下载:

下载windwos版本的PHP:http://windows.php.net/download/ (我下载的是PHP5.4.9_VC9 x86 Non Thread Safe,下载地址:http://windows.php.net/downloads/releases/php-5.4.9-nts-Win32-VC9-x86.zip)

 

下载windows版本的mysql:http://dev.mysql.com/downloads/(我下载的是32位的MySql Community Server,下载地址:http://10.10.4.4/download/30441461/38229922/3/msi/170/240/1349924169898_752/mysql-5.5.28-win32.msi)

 

PHP文档参考:

php官方说明文档:http://www.php.net/manual/zh/index.php

下载地址:http://www.php.net/download-docs.php

 

PHP安装配置:

解压缩下载到的php-5.4.9-nts-Win32-VC9-x86.zip到D:\php\5.4.9\(必须手动设置此目录的可读写权限,“属性”-“安全”-“编辑”,添加IIS_USERS。使IIS_ISURS和Users完全控制)

1.修改php.ini-development文件为php.ini,并打开。

2.去掉注释

;fastcgi.impersonate = 1 修改为 fastcgi.impersonate = 1
;cgi.fix_pathinfo=1 修改为 cgi.fix_pathinfo=1
;cgi.force_redirect = 1 修改为 cgi.force_redirect = 0
; extension_dir = "ext" 修改为 extension_dir = "D:\php\5.4.9\ext"

3.开启相应的扩展库:

extension=php_curl.dll 
extension=php_gd2.dll 
extension=php_mbstring.dll 
extension=php_mysql.dll 
extension=php_mysqli.dll
extension=php_pdo_mysql.dll 
extension=php_pdo_odbc.dll 
extension=php_xmlrpc.dll

4.配置PHP的Session功能

在使用session功能时,我们必须配置session文件在服务器上的保存目录,否则无法使用session,我们需要在Windows 7上新建一个可读写的目录文件夹,此目录最好独立于WEB主程序目录之外,此处我在D:\php\5.4.9\目录上建立了tmpSession目录,然后在php.ini配置文件中找到

;session.save_path = "/tmp" 修改为 session.save_path = "D:\php\5.4.9\tmpSession"

5.配置PHP的文件上传功能

同session一样,在使用PHP文件上传功能时,我们必须要指定一个临时文件夹以完成文件上传功能,否则文件上传功能会失败,我们仍然需要在Windows 7上建立一个可读写的目录文件夹,此处我在D:\php\5.4.9\目录上建立了tmpUpload目录,然后在php.ini配置文件中找到

;upload_tmp_dir = 修改为 upload_tmp_dir = "D:\php\5.4.9\tmpUpload"

6.修改date.timezone,否则可能会报错。

;date.timezone = 修改为 date.timezone = "Asia/Shanghai",有的文章说也可改为PRC。

(PHP官方文档参考:http://www.php.net/manual/zh/timezones.asia.php)

7.php.ini的配置就算完成了,如果有什么变动也可以回来进行修改。还有IIS对php的支持,下边的会进行详细的介绍。

8.测试php

在“开始-运行-cmd”下试着运行d:\php\5.4.9\php -id:\php\5.4.9\php -v,正常来说-i参数可以看到一大堆参数信息,而-v参数可以看到php的版本信息,如果把dll文件不存在的扩展打开了的话,-v时会有提示。

 

IIS配置:

查阅PHP官方说明文档http://www.php.net/manual/zh/install.windows.iis7.php

1.给IIS添加CGI支持:

在Windows7的控制面板-程序中“打开/关闭Windows功能”,在里面打开Internet信息服务-万维网服务-应用程序开发功能,勾选CGI,点击确定。

Win7+IIS+PHP+MySql 配置

2.打开IIS控制台,在左边树中选最顶级结点,也就是你的电脑名,然后在中间(功能视图)里打开“处理程序映射”(英文文叫“Handler Mappings”),打开之后在最右边点“添加模块映射”(Add Module Mapping),在打开的窗口中输入以下信息。

  • Request path(请求路径): *.php
  • Module(模块): FastCgiModule
  • Executable(可执行文件): D:\php\5.4.9\php-cgi.exe (选的时候把类型由dll改成exe)
  • Name(名称): PHP_via_FastCGI

3.按自己需要在IIS网站的“默认文档”中添加"index.php"。

4.重新启动IIS。完成IIS配置。

5.在IIS中测试PHP。

打开记事本,输入,保存为index.php,将文件保存到IIS网站的根目录下,一般为C:\inetpub\wwwroot。

在浏览器中输入http://localhost/index.php。

页面显示PHP版本等信息表示配置成功。

Win7+IIS+PHP+MySql 配置

 

 MySql安装与配置:

1.打开安装文件,进行安装。

2.选择安装类型,这里选择Custom:

Typical(典型安装)
Installs the most common program features Recommended formost users
安装最常用的程序功能,建议大多数用户使用
Custom(自定义安装)
Allows users to choose which program features will be installed where they will be installed Recommended foradvanced users
意思是:允许用户选择安装的程序和选择安装的位置建议高级用户使用
Complete(安全安装)
All program features will be installed Requires the most disk space
意思是:将安装所有的功能程序,需要最多的硬盘空间

3.选择安装路径。

4.点击"install"进行安装.

5.安装完成后,选中"launch the MySql Instance Configuration Wizard",点击"finish”,并启动MySql实例配置向导。

6.选择配置方式,选择Detailed Configuration。

Detailed Configuration(手动精确配置)
Standard Configuration(标准配置)

Win7+IIS+PHP+MySql 配置

7.选择,选择Developer Machine,也可以选择Server Machine,根据自己情况选择即可。

Developer Machine(开发测试类,mysql 占用很少资源)
Server Machine(服务器类型,mysql占用较多资源)
Dedicated MySQL Server Machine(专门的数据库服务器,mysql占用所有可用资源)

Win7+IIS+PHP+MySql 配置

8.选择mysql数据库的大致用途。我选择的是Multifunctional Database。

Multifunctional Database(通用多功能型,好)
Transactional Database Only(服务器类型,专注于事务处理,一般)
Non-Transactional Database Only(非事务处理型,较简单,主要做一些监控、记数用,对MyISAM数据类型的支持仅限于non-transactional

Win7+IIS+PHP+MySql 配置

9.选择数据库文件存储位。这里不做修改默认即可。

10.选择您的网站的一般mysql 访问量,同时连接的数目。我Manual Setting,并设置连接数为20。(根据自己实际情况选择即可)

Decision Support(DSS)/OLAP(20个左右)
Online Transaction Processing(OLTP)(500个左右)
Manual Setting(手动设置,自己输一个数)

Win7+IIS+PHP+MySql 配置

11. 选择是否启用TCP/IP连接,设定端口(如果不启用,就只能在自己的机器上访问mysql 数据库)。(选中,端口默认)
"Add firewall exception ……",将MYSQL服务的监听端口加为windows防火墙例外,避免防火墙阻断(此处我没有选中,默认即可)。
选择“启用标准模式”(Enable Strict Mode),这样MySQL就不会允许细小的语法错误。(选中)。

Win7+IIS+PHP+MySql 配置

12.选择MySql默认编码格式,我选择第三个Manual Selected Default Charactor Set/Collation,并选择"uft8'。

Win7+IIS+PHP+MySql 配置

13.,还可以指定Service Name(服务标识名称)(默认即可)
是否将mysql的bin目录加入到Windows PATH(加入后,就可以直接使用bin下的文件)。(选中)

Win7+IIS+PHP+MySql 配置

14.为MySql的root(超级管理员)用户设置密码,也可以不设置,完成配置后也可以进行修改。(这里我设置了密码)
Enable root access from remotemachines是否允许root 用户在其它的机器上登陆。(为了方便这里我勾选上了)
Create An Anonymous Account新建一个匿名用户。(这里我没有勾选)

Win7+IIS+PHP+MySql 配置

15.设置完成后,点击"Execute"。

16.完成MySql的安装与配置。


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)

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

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

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

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 install and configure DRBD on CentOS7 system? Tutorial on implementing high availability and data redundancy! How to install and configure DRBD on CentOS7 system? Tutorial on implementing high availability and data redundancy! Feb 22, 2024 pm 02:13 PM

DRBD (DistributedReplicatedBlockDevice) is an open source solution for achieving data redundancy and high availability. Here is the tutorial to install and configure DRBD on CentOS7 system: Install DRBD: Open a terminal and log in to the CentOS7 system as administrator. Run the following command to install the DRBD package: sudoyuminstalldrbd Configure DRBD: Edit the DRBD configuration file (usually located in the /etc/drbd.d directory) to configure the settings for DRBD resources. For example, you can define the IP addresses, ports, and devices of the primary node and backup node. Make sure there is a network connection between the primary node and the backup node.

Where can I check the configuration of my win11 computer? How to find the configuration information of win11 computer Where can I check the configuration of my win11 computer? How to find the configuration information of win11 computer Mar 06, 2024 am 10:10 AM

When we use win11 system, we sometimes need to check the configuration of our computer, but many users are also asking where to check the configuration of win11 computer? In fact, the method is very simple. Users can directly open the system information under settings, and then view the computer configuration information. Let this site carefully introduce to users how to find win11 computer configuration information. How to find win11 computer configuration information. Method 1: 1. Click Start and open Computer Settings. 3. You can view computer configuration information on this page. 2. In the command prompt window, enter systeminfo and press Enter to view the computer configuration.

How to implement HTTP streaming using C++? How to implement HTTP streaming using C++? May 31, 2024 am 11:06 AM

How to implement HTTP streaming in C++? Create an SSL stream socket using Boost.Asio and the asiohttps client library. Connect to the server and send an HTTP request. Receive HTTP response headers and print them. Receives the HTTP response body and prints it.

See all articles