PHP Environment configuration: windows7+iis7+php+mysql

Source: Internet
Author: User
Configure requirements
    • Operating System: Windows7 (x32/x64), windows2008
    • IIS version:7.0
    • PHP Version:7.0.6 and above
    • MySQL version:5.7.12 and above
First step: Install IIS

Note : Starting with the IIS 7+php 5.5 version, the configuration of the PHP environment under Windows is completely different, faster and easier than the previous version of the installation, with fastcgi, just a simple mouse operation to run the PHP environment.

1. Find the "Control Panel" and "programs and features" = "Turn Windows features on or off"

Default "Internet Information Services" Tick install

Direct selection of CGI, automatically installs fastcgi, no need to install ISAPI

2. Create a new Site Directory

Run-inetmgr

Right-click sites + Add sites

Add site information, must be set as shown in the picture, in addition to path preferences

Pop up "80 port occupancy", meaning you will have another site "Default Web site" at the same time occupy 80 ports, workaround:

    1. Click Cancel to return to the Modify port and re-determine.
    2. Click OK to close one of the sites each time you use it

Step Two: Install PHP

: http://windows.php.net/download/
The official website can be downloaded to the latest version of the Windows PHP package, but Php.net has abandoned the 5.6 version of the previous environment pack, Uncle here to organize a list of the previous environment package, the students need to get their own

Baidu Cloud Disk: pan.baidu.com/s/1bjgfhrchrbj1vfkggegz8g
Access Password: 11mh

After extracting the PHP environment package, locate the Php.ini-xxx file

Since it is a local development test, Uncle suggested: Copy "Php.ini-development" and paste, rename to PHP.ini

Php.ini-development
Php.ini-dist
(name after version 5.5 )
(previous name of version 5.5)
Has a lower security setting and is appropriate for the development program to use the permissions
Php.ini-production
php.ini-recommended
(name after version 5.5 )
(previous name of version 5.5)
With a high security setting, it is suitable for use in a server that is officially on-line
Configure PHP.ini1. Setting up the Extension_dir plugin

Search and find Extension_dir = "", and enter the location of the PHP plugin ext directory, Extension_dir = "c:/programfiles/xxx/xxx/php directory name/ext"

Search and find extension_dir=, will find the plugin directory list, uncle suggested to open the following plugins (remove the front ";" ) Maintain most of the PHP site functionality, if there are other requirements to open other plug-ins ( Note: Configuration once php.ini will need to restart IIS)

plug-in name plug-in features
Extension=php_bz2.dll Compression plug-in
Extension=php_curl.dll Remote pasting
Extension=php_gd2.dll GD Library
Extension=php_mbstring.dll Short label
Extension=php_mysql.dll MySQL old engine
Extension=php_mysqli.dll MySQL new engine
Extension=php_pdo_mysql.dll MYSQLPDO Connection

2. Set time zone: Date.timezone = Asia/shanghai 3.IIS Add PHP Support

Run-inetmgr

Open: Handler mappings

Open: Add module Mappings

Fill in the following content

Sure there will be a prompt, click "OK"

The mapper is added successfully, and a PHP program mapping record is in the list

Such a iis+php environment is built.

PHP Package: Version/model Difference
    • Before version 5.5
      Windows configuration iis+php, need to install VC9
      Windows configuration apache+php, need to install VC6
    • After 5.5 version only vcxx, just choose the threading mode and 32-bit/64-bit system can be
      Non thread safe refers to non-thread safety, thread safe
      Using the ISAPI method to run PHP requires a thread safe version
      Using fastcgi mode to run PHP, there is no need to use thread security, with the None thread safe (NTS, non-thread-safe) version to better improve efficiency
FastCGI Process Error Rollup Error 1:PHP-CGI.EXE-FASTCGI Process quits unexpectedly

Open the http://localhost page, prompting the above error, more than 95% is the environment corresponding to the VC version is not installed.

You need to find the PHP VC number corresponding to the Visual C + + redistributable for Visual Studio development version:

VC No. vs corresponding version number
VC6 VC6.0
VC7 VS2002
VC7.1 VS2003
VC8 VS2005
VC9 VS2008
VC10 VS2010
VC11 VS2012
VC12 VS2013
VC13 VS2014
VC14 VS2015

5.5 version needs to be installed VS2012
5.7 version needs to be installed VS2015

Error 2:An unknown FastCGI error occurred with error code 0X8007010B

If the previous installation strictly as described in this article, that should consider the permissions issue, whether the PHP, Apache, MySQL program placed in the C-disk strictly controlled location (such as the desktop ).

Add the program folder "everyone", the permission is "all", re-refresh the page.

Step Three: Install MySQL

: dev.mysql.com/downloads/mysql/

Baidu Cloud Disk: pan.baidu.com/s/19ffxcvygtubmmznwi8cb6g
Access Password: L5FB

Uncle recommended the use of free installation version, the use of CMD installation, is the easiest way to familiarize yourself with MySQL, the installation process of this article is the green version of the standard.
Baidu Network disk is the support of this article MySQL 5.7 Official free installation version

Go to the website download page, drag to the bottom, or search the page for other Downloads:

32-bit system download:Windows (x86, 32-bit), ZIP Archive
64-bit system download:Windows (x86, 64-bit), ZIP Archive

Configure My.ini

"My.ini" is the core file used by MySQL installation, which needs to be guided by the installation and use.

Unzip the file, copy the my--default.ini copy and rename it to My.ini(the new version seems to be no longer with My--default.ini, so you build one in the root directory My.ini)

1. Set the MySQL installation path

In My.ini , be sure to have the following character, if it does not exist, just code it in, then save it,

[Mysqld] #skip-grant-tables #这名加上可以跳过验证basedir = C:/user/administrator/xxx/xxx/mysql-noinstall-5.1.53-win32 #根目录 # Datadir=c:/user/administrator/xxx/xxx/mysql-noinstall-5.1.53-win32/data #数据文件存放目录
2. Manually install MySQL

Open the CMD console

Through the CMD CD command, go to the Bin folder under the root directory of MySQL

Under the Bin folder , enter the following three instructions separately:

Mysqld--install MySQL  Enter (success will prompt, S start letter) Mysqld-remove          Enter (if there is an error in the installation location, use this command to remove the configuration and then reinstall.) ) net start MySQL         Enter (Success will prompt service already running)

If the installation is successful, you can easily turn MySQL on/off with the CMD command.

Note: The encoding must be set to ANSI when saving "My.ini", otherwise the following error will be reported

Error:found option without preceding group in config File:d:\program Files\mysql-5.6.25-winx64\my.ini at line:1
Fatal error in defaults handling. Program aborted.

At this point, you run the net start mysql command in CMD , Congratulations, you entered the MySQL card loop state.

Error message Solution Rollup 1. Service failed to start

C:xxx>mysql>bin>net start MySQL
MySQL service is starting ....
The MySQL service could not be started.
The service did not report any errors.
Please type NET helpmsg 3534 for more help.

Solution: The "MySQL" service fails to start, and the service does not report any error resolution

2. New Installation mysql,root blank password cannot log in

Mysql> Mysql-u Root-p
Enter Password:
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Solution: "MySQL" installation is not installed and started successfully, unable to log on, root account password forced reset

Fourth step: Set pseudo-static

1. Download the Microsoft URL Rewrite Module 2.0 template for IIS 7

Official website 64-bit: http://www.microsoft.com/zh-cn/download/details.aspx?id=7435
Official website 32-bit: http://www.microsoft.com/zh-cn/download/details.aspx?id=5747
IIS URL Rewrite:http://www.iis.net/download/urlrewrite

2. Setting up the Web. config

<rewrite><rules><rule name= "rewrite to index.php" stopprocessing= "true" ><match url= "^ Index.html "/><action type=" Rewrite "url=" index.php "/></rule><rule name=" Rewrite to Article.php " Stopprocessing= "true" ><match url= "^article_ (d+). html"/><action type= "Rewrite" url= "article.php?id={r : 1} "/></rule><rule name=" Rewrite to List.php "stopprocessing=" true "><match url=" ^list_ (d+) _ (d+). HTML "/><action type=" Rewrite "Url=" List.php?id={r:1}&page={r:2} "/></rule><rule name=" Rewrite to Category.php "stopprocessing=" true "><match url=" ^ (. *) "/><action type=" Rewrite "url=" Category.php?category={r:1} "/></rule></rules></rewrite>
Other questions problem 1:file upload error-unable to create a temporary File in Unknown on line 0

Reason: Because the temporary directory of PHP is not read/write

Solution:

    1. Open php.ini find upload_tmp_dir
    2. Find a location for PHP to upload the temp directory, then upload_tmp_dir = "d://upload/"
Question 2:php notice:undefined variable

Cause: PHP Default configuration will report this error, although it is helpful to find errors, but at the same time there will be many problems in practice.

Workaround:

Method 1: Modify the php.ini configuration file error_reporting settings:

    1. Find error_reporting = E_all
    2. Modified to error_reporting = e_all & ~e_notice

Principle: Reduce the sensitivity of PHP, so that it encountered this problem does not error. (This is not recommended and will cause your error syntax to continue to go wrong.)

Method 2: Add the following code to the header of the PHP file

<?php ini_set ("error_reporting", "E_all & ~e_notice");? >

The same can solve the problem, but it is also not recommended, this method.

Method 3: Fix your grammar and make your code more canonical!!!

Appendix Windows R2 IIS Role installation method

Windows R2 is a server version, so there are some differences between installing IIS7 and non-server versions, and you need to use the role system installation

First Step: Install IIS

First go to Control Panel = + Turn Windows features on or off

Server version enters Server Manager , we need to go to " roles " and add roles to increase IIS functionality

Go to the Guide page and click "Next"

Tick "Web Server (IIS)" and click Next

The next step, remember to check the CGI , do not tick the ISAPI

Wait for the installation process

The final display "Install succeeded", that is done.

Windows 10:mysql My.ini and Windows7 are not common

Windows 7/8/10/2008r2 all use the IIS7, the use and the installation method is almost consistent, but because of Microsoft's behavior, the system is different, the bug will be different, here Uncle recorded some installation of other systems encountered some record.

MySQL my.ini files, each system can not be common, so in the installation, can not directly transfer Windows7 MySQL directly past, the uncle will rewrite the my.ini can be normal use.

[Winmysqladmin] Server= "C:/users/administrator/***/***/***/mysql-5.7.16/bin/mysqld.exe" [client] No-beep # pipe # socket=mysql port= 3306 [Mysql]default-character-set=utf8 # for advice The change settings "See # HTTP://DEV.MYSQL.COM/DOC/REFMA n/5.6/en/server-configuration-defaults.html # * * * does not EDIT the this FILE. It's a template which'll be copied to the # * * * * default location during install, and'll be replaced if you # * * * Upgra De to a newer version of MySQL.  [mysqld] Explicit_defaults_for_timestamp = true# Remove Leading # and set to the amount of RAM for the most important data # Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%. Innodb_buffer_pool_size = 2G # Remove Leading # to turn in a very important data integrity Option:logging # changes to T He binary log between backups.  # Log_bin # These is commonly set, remove the # and set as required. #basedir = "C:\mysql-5.7.11-win32\" Basedir = "c:\users\administrator\***\***\***\mysql-5.7.16\" #dAtadir= "C:\mysql-5.7.11-win32\data\" DataDir = "C:\users\administrator\***\***\***\mysql-5.7.16\data\" port=3306 Server_id=1 general-log=0 general_log_file= "Mysql_general.log" slow-query-log=1 slow_query_log_file= "Mysql_slow_ Query.log "long_query_time=10 log-error=" Mysql_error_log.err "Default-storage-engine=innodb max_connections=1024 query_cache_size=128m key_buffer_size=128m innodb_flush_log_at_trx_commit=1 innodb_thread_concurrency=128 innodb_ autoextend_increment=128m tmp_table_size=128m # Remove Leading # To set options mainly useful for reporting servers. # The server defaults is faster for transactions and fast selects. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M #sql_mode =no_engine_substitution,strict_tra Ns_tables sql-mode= "Strict_trans_tables,no_auto_create_user,no_engine_substitution" Character-set-server=utf8 Innodb_flush_method=normal

Disclaimer: This site article no special description, are original, all rights reserved, please specify: Dy uncle's Daily

From PHP Environment configuration: windows7+iis7+php+mysql--for (R2/8/10) | Xdy. Uncle Me@dy's Daily

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: