Preparation 1. Environmental Description: Operating system: Windows Server 2019 PHP version: php 7.3.11 MySQL version: MySQL 8.0.18.0 2. Download related software: 1. PHP download address: https://windows.php.net/downloads/releases/php-7.3.11-nts-Win32-VC15-x64.zip 2. MySQL download address: https://cdn.mysql.com//Downloads/MySQLInstaller/mysql-installer-community-8.0.18.0.msi 3. Visual C++ Redistributable for Visual Studio 2015 (this plug-in is required to install PHP and MySQL) https://download.visualstudio.microsoft.com/download/pr/11100229/78c1e864d806e36f6035d80a0e80399e/VC_redist.x86.exe https://download.visualstudio.microsoft.com/download/pr/11100230/15ccb3f02745c7b206ad10373cbca89b/VC_redist.x64.exe 4. Download address of Microsoft URL Rewriting Module 2.0 (IIS pseudo-static requires this plug-in) https://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi Installation 1. Install IIS10.0 Control Panel - System and Security - Administrative Tools Server Manager Adding roles and features Next step Choice: Role-based or feature-based installation Next step Select: Select a server from the server pool Next step Select: Web Server (IIS) Adding functionality Next step Next step Next step Make sure CGI is selected and select other role services as needed. If you don’t know how to choose, it is recommended to select all functions. Next step Install If it says that the installation was successful, click Close. You can see that IIS already exists in the role and server group. Open the IE browser and enter http://127.0.0.1/ to see the following interface IIS10.0 has been installed. 2. Install PHP 1. Visual C++ Redistributable for Visual Studio 2017 (x86, x64) Installing x86 Install x64 After all installations are complete, click Close. 2. Install php-7.3.11-nts-Win32-VC15-x64.zip Unzip 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 drive C Open C:\php Copy php.ini-production to php.ini Open php.ini with Notepad Make the following additions and modifications: extension_dir = "C:\php73\ext" #Set 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 extension modules can be enabled as needed, and the semicolon in front will be removed to start the corresponding extension 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 - System and Security - Administrative Tools Open Server Manager Double-click the computer name under "Start Page" on the left Find the IIS section in the middle and open "Handler Mappings". Click "Add module mapping" on the right Request path: *.php Module: FastCgiModule Executable file (optional): C:\php73\php-cgi.exe Name: FastCGI Finally, confirm yes Double-click the computer name under "Start Page" on the left Find the IIS section in the middle and open "FastCGI Settings" Right click and select: C:\php73\php-cgi.exe and select Edit Watch for changes made to the file: C:\php73\php.ini Environment variables, click the "..." next to it. Click "Add" Name: PHP_FCGI_MAX_REQUESTS Value: 1000 Sure Double-click the computer name under "Start Page" on the left Find the IIS section in the middle and open "Default Document" Click "Add" on the right Name: index.php Sure You can select the "Move Up" option under the right operation to move index.php to the top 4. Test whether the PHP program runs normally Open: C:\inetpub\wwwroot Create a new index.php file The content is as follows: <?php phpinfo(); ?> Finally, save and exit Open http://127.0.0.1/ in your browser The following interface appears, saying that the PHP program can run normally. 3. Install MySQL Double-click to open mysql-installer-community-8.0.18.0 Select Custom Next Edit Select MySQL Servers 64-bit Filter Click on MySQL Servers Select the version you want to install and click the arrow to move to the right window Next Execute Next Next Default, Next Config Type: Developer Machine Server Machine Dedicated Machine Select the second option here: Server Machine (normal server) Check "TCP/IP" Port Number: 3306 Check "Open firewall port for network access" Next Select the second option to use an encryption method compatible with MySQL versions prior to 5.7 Next MySQL Root password: Enter your password Repeat Password: Repeat the password After setting, click Next Check: Configure MySQL system services Windows Server Name: MySQL80 Check "Start the MySQL Server at System Startup" Check: Standard System Account The system user is used by default to run Next Execute Finish Next Finish Open the MySQL installation path C:\Program Files\MySQL\MySQL Server 8.0 Create a new configuration file 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 for mysql database data datadir=C:\Program Files\MySQL\Data # Maximum number of connections allowed max_connections=1000 # The number of connection failures allowed. This is to prevent someone from trying to attack the database system from this host. max_connect_errors=10 # The default character set used by the server is UTF8 character-set-server=utf8 # The default storage engine that will be used when creating new tables default-storage-engine=INNODB # By default, the "mysql_native_password" plugin is used for authentication default_authentication_plugin=mysql_native_password [mysql] # Set the default character set for the mysql client default-character-set=utf8 [client] # Set the default port used by the mysql client 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 during installation, press Enter, and log in to the MySQL console MySQL installation complete 4. Configure IIS10.0 to support pseudo-static Double-click to install the Microsoft URL Rewrite Module rewrite_x64_zh-CN.msi An error message appears, confirm Search-Run Enter regedit, confirm, open the registry, and find: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters The MajorVersion on the right is a DWORD value, and its decimal value is 10. Change it to 9. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp Also MajorVersion item, this one also has a dword value of 10 (note it is decimal), change it to 9 Then install it again, remember to change it back after installation. Install again Install Finish You can see "URL Rewrite" in: Control Panel-System and Security-Administrative Tools-Internet Information Services (IIS) Manager Create a new file web.config in the root directory of the website and add pseudo-static rule code to make the website static. At this point, the Windows Server 2019 IIS10.0+PHP (FastCGI)+MySQL environment construction tutorial is completed. You may also be interested in:
|
<<: Example code for implementing large screen adaptation on PC using vue+px2rem (rem adaptation)
>>: SQL Get stored procedure return data process analysis
You may often see the following effect: That’s ri...
Table of contents Tutorial Series 1. Introduction...
1. Introduction to Docker Docker is developed in ...
I came into contact with CSS a long time ago, but...
HTML onfocus Event Attributes Definition and Usag...
This article shares the specific code of jQuery t...
Table of contents 1. React.Children.map 2. React....
Table of contents 01 Scenario Analysis 02 Operati...
The problems and solutions encountered when insta...
Table of contents 1. Structure string 2. Return t...
This article lists some tips and codes about form...
Query the current date SELECT CURRENT_DATE(); SEL...
Table of contents Directory Structure bin directo...
This article shares the specific code of vue+elem...
1. Requirements: Database backup is particularly ...