The simplest in history! Install PHP under IIS

Source: Internet
Author: User
I have previously referred to many articles on installing php under iis on the Internet, all of which are copying php. ini and a bunch. dll, a single person said, a mess, many installation tutorial writers themselves do not know how to copy these things, such configuration is used. After a morning of suffering and experimentation, I finally figured out the path here. Now I want to tell you

I have previously referred to many articles on installing php under iis on the Internet, all of which are copying php. ini and a bunch. dll, a single person said, a mess, many installation tutorial writers themselves do not know how to copy these things, such configuration is used. After a morning of suffering and experimentation, I finally figured out the path here. Now I want to tell you

I have previously referred to many articles on installing php under iis on the Internet, all of which are copying php. ini and a bunch. dll, a single person said, a mess, many installation tutorial writers themselves do not know how to copy these things, such configuration is used. After a morning of suffering and experimentation, I finally figured out the following path:

The general tutorial ends with seeing phpinfo (), so I will tell you that it is very easy to run php to see it, the core is to add it in iis. php process.

Simplest installation process:

1. Download php5.2.5 first:
Http://www.onlinedown.net/soft/1772.htm
Decompress the package to a folder and change the file name to a simple one (for your convenience, not a required step). For example, if my file is D:/php5.2.5

2. Open IIS, right-click "default website", and choose "properties"> "main directory"> "configuration"> "add ".
Executable File: D:/php5.2.5/php5isapi. dll
Extension:. php
OK

Open IIS, Web Service extension-> Add a new service extension. php, select D:/php5.2.5/php5isapi. dll as the required file, and set the extension status to allow the hook.

OK

3. Add the User group access permission to php5.2.5.

4. Add PHPRC = D:/php5.2.5 to the environment variable.

5. Rename php. ini-recommended to php. ini in D:/php5.2.5.


Create a. php under E:/php. The content is

7. Open http: // localhost/php/a. php and you will see the phpinfo stuff!

Although the simplest installation method allows you to use the basic functions of php, but the extensions such as connecting to mysql have not yet been installed, I recommend the standard installation process, in case of any problems in the future, hit me with bricks.

Standard installation process:

1. Download php5.2.5 first:
Http://www.onlinedown.net/soft/1772.htm
Decompress the package to a folder and change the file name to a simple one (for your convenience, not a required step). For example, if my file is E:/php5.2.5

2. Copy php. ini-dist in the php5.2.5 folder to C:/WINDOWS and change it to php. ini.
And modify the following items:
Extension_dir = "./" is extension_dir = "E:/php5.2.5/ext". This is another php function library.
Remove the semicolon before extension = php_gd2.dll. This function is related to the support for images in the GD function library.
Remove the semicolon before extension = php_mysql.dll. This is the MYSQL function library.
PS: If you want to use cgi to parse the PHP file (the cgi method is explained below), remove the semicolon before cgi. force_redirect = 1 and Change 1 to 0.
Save

3. Copy php5ts. dll and libmysql. dll to C:/WINDOWS/system32.


Create a. php under E:/php. The content is

6. Open http: // localhost/php/a. php and you will see the phpinfo stuff!

Possible problems:

1. Add in iis. in php, enter the path in the executable file column and click OK. The error message "Incorrect executable file name" is displayed because your path contains spaces, for example, there is a space in the programme files. The solution is to add "" quotation marks to all paths, if you use the path obtained through browsing, windows will automatically quote you when there is space in the path. My approach is to put php in a path without quotation marks.

2. Some tutorials in php.exe refer to php5isapi. dll. I will explain that php.exe processes. php files in cgi Mode, while php5isapi. dll is in ISAPI mode. Cgi is a popular method with a long history of good compatibility. The ISAPI method is unique by Microsoft and can only be used on IIS at present, but the execution efficiency is better than cgi, I am using the ISAPI method.

3. When Using cgi to browse phpinfo, the following situations may occur:
Security Alert! The php cgi cannot be accessed directly.
This php cgi binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
Don't worry, this is because PHP is running in IIS in Cgi Mode, and this item is not opened in your php configuration file. If you see the above warning, you need to open your php. INI file, and then find "cgi. force_redirect = 1 ", remove the semicolon before this sentence, and change 1 to 0.

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.