Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build Windows Server 2019 IIS10.0+PHP (FastCGI) + MySQL environment

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you how to build Windows Server 2019 IIS10.0+PHP (FastCGI) + MySQL environment, the content is easy to understand, I hope you can learn, there will be gains after learning, let the editor take a look at it.

Preparation article

Environment description:

Operating system: Windows Server 2019

PHP version: php 7.3.11

MySQL version: MySQL 8.0.18.0

Installation section

First, install IIS10.0

Control Panel-Systems and Security-Management tools

Server Manager

Add roles and featur

Next step

Select: role-based or feature-based installation

Next step

Select: select a server from the server pool

Next step

Select: Web Server (IIS)

Add featur

Next step

Next step

Next step

Make sure that CGI is selected, and other role services are selected as needed. If you don't know how to choose, it is recommended to select all features.

Next step

Installation

Shows that the installation is successful, click to close.

You can see that IIS already exists in roles and server groups

Open the IE browser and type http://127.0.0.1/ to see the following interface

IIS10.0 has been installed.

Second, install PHP

1. Visual C++ Redistributable for Visual Studio 2017 (x86, x64)

Install x86

Install x64

After all the installation is complete, click to close.

2. Install php-7.3.11-nts-Win32-VC15-x64.zip

Extract the php-7.3.11-nts-Win32-VC15-x64.zip file

Rename the folder to php73 and copy the php73 folder to the root directory of the C disk.

Open C:\ php

Copy php.ini-production to php.ini

Open php.ini with notepad

Add the following modifications:

Extension_dir = "C:\ php73\ ext" # set the php module path

Date.timezone = PRC # set the time zone to China time zone

Cgi.force_redirect = 0 # enable running php in CGI mode

Fastcgi.impersonate = 1

Cgi.rfc2616_headers = 1

The following php expansion module, open as needed, cancel the previous semicolon to start the corresponding expansion module

Extension=curl

Extension=gd2

Extension=mbstring

Extension=exif

Extension=mysqli

Extension=sockets

Extension=php_xmlrpc

Extension=php_pdo_mysql

After the modification is completed, save and exit

3. Configure IIS to support PHP

Open Control Panel-Systems and Security-Management tools

Open Server Manager

Double-click the computer name under the start page on the left

Locate the middle IIS section and open Handler Mapping.

Add module mapping to the right of the point

Request path: * .php

Module: FastCgiModule

Executable file (optional): C:\ php73\ php-cgi.exe

Name: FastCGI

Finally, make sure

Yes

Double-click the computer name under the start page on the left

Find the middle IIS section and open "FastCGI Settings"

Right-click: C:\ php73\ php-cgi.exe and select Edit

Monitor changes to the file: C:\ php73\ php.ini

Environment variable, click "."

Click "add"

Name:PHP_FCGI_MAX_REQUESTS

Value:1000

Confirm

Double-click the computer name under the start page on the left

Find the middle IIS section and open the default document

Click "add" to the right

Name: index.php

Confirm

You can select the "move up" option below the action on the right to move index.php to the top.

4. Test whether the php program is running properly.

Open:

C:\ inetpub\ wwwroot

Create a new index.php file

The contents are as follows:

Finally, save exit

Open http://127.0.0.1/ in the browser

The following interface appears, saying that the php program can run normally.

Third, install MySQL

Double-click to open mysql-installer-community-8.0.18.0

Check "Custom" (Custom installation)

Next

Edit

Select MySQL Servers 64-bit

Filter

Click on MySQL Servers

Select the version to install and click the arrow to move to the right window

Next

Execute

Next

Next

Default, Next

Config Type (configuration type):

Developer Machine (development server)

Server Machine (normal server)

Dedicated Machine (dedicated server)

Choose the second item here: Server Machine (normal server)

Check "TCP/IP"

Port Number (Port): 3306

Check "Open firewall port for network access" (open firewall port for network access)

Next

Select the second option to use encryption compatible with previous versions of MySQL5.7

Next

MySQL Root password: enter password

Repeat Password: enter password repeatedly

After setting up, click Next

Check: configure MySQL system service

Windows Server Name (Windows service name): MySQL80

Check: "Start the MySQL Server at System Startup" (start the MySQL server when the system starts)

Check: Standard System Account runs with system users by default

Next

Execute

Finish

Next

Finish

Open the MySQL installation path

C:\ Program Files\ MySQL\ MySQL Server 8.0

New profile my.ini

[mysqld]

# set port 3306

Port=3306

# set the installation directory of mysql

Basedir=C:\ Program Files\ MySQL\ MySQL Server 8.0

# set the storage directory of the data in the mysql database

Datadir=C:\ Program Files\ MySQL\ Data

# maximum number of connections allowed

Max_connections=1000

# the number of failed connections allowed. This is to prevent someone from trying to attack the database system from the host.

Max_connect_errors=10

# the character set used by the server defaults to UTF8

Character-set-server=utf8

# default storage engine to be used when creating new tables

Default-storage-engine=INNODB

# use "mysql_native_password" plug-in authentication by default

Default_authentication_plugin=mysql_native_password

[mysql]

# set mysql client default character set

Default-character-set=utf8

[client]

# set the default port for mysql clients to connect to the server

Port=3306

Default-character-set=utf8

Save

Open C:\ ProgramData\ Microsoft\ Windows\ Start Menu\ Programs\ MySQL\ MySQL Server 8.0

Double-click MySQL Server 8.0 Command Line Client

Enter the MySQL root account password at the time of installation, enter, and log in to the MySQL console

MySQL installation completed

4. Configure IIS10.0 to support pseudo-static

Double-click to install the Microsoft URL rewriting module rewrite_x64_zh-CN.msi

Error prompt appears, OK

Search-run

Enter regedit, OK, open the registry, and find:

HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ W3SVC\ Parameters

The MajorVersion on the right is the DWORD value, which has a decimal value of 10. Change it to 9.

HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ InetStp

It's also a MajorVersion term, and this is also a dword value of 10 (note that it's decimal). Change it to 9.

Then install it again, and remember to change it back after installation.

Install again

Installation

Complete

You can see "URL rewriting" in: control Panel-Systems and Security-Management tools-Internet Information Services (IIS) Manager

Create a new file web.config under the root directory of the website and add the pseudo-static rule code to realize the website static.

The above is about how to build Windows Server 2019 IIS10.0+PHP (FastCGI) + MySQL environment. If you have learned knowledge or skills, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report