Deploying PHP on IIS 7

Source: Internet
Author: User
Tags vc9

Preface

A time ago the whole of a hung Q platform. Source code is downloaded from the Internet, the latter slightly adjusted the link and title and other text on the line. Details are here.

Run for a period of time, in addition to the occasional QQ offline line, the overall effect is basically in line with expectations, personal feeling is satisfied, but also small sense of accomplishment.

But after a couple of weeks of running, free space is not a force. Remind me that the site hangs because more than 1000 CPU usage exceeds 20%, requiring the entire hos***24 to be unlimited.

Originally, I do not want to be so troublesome to change space. But used for more than a year three egg space, feel every now and then do not give force, a while the site deleted, a moment because of this kind of reason hangs up, just have another space on hand, Amazon's free space for a year, for the moment first.

But here's the problem, Amazon's virtual server is a Windows 2008 system that was originally designed to host an ASP. NET site, with IIS 7.5+.net4.0/4.5 installed. For the php+mysql combination, no configuration is done.

That being the case, indispensable starts with (Bai) 0 (du).

Baidu came out quite a lot of results also quite detailed, illustrated, there are installed configuration, very good, let's start it!

BodyFirstly, download the relevant file first: download php , download mysql.

When you download PHP, be aware that I downloaded the file php-5.6.3-win32-vc11-x64.zip, here are a few information, version 5.6.3,x64, there is a VC11.

VC9 and VC11

More recent versions of PHP is built with VC9 or VC11 (Visual Studio, and compiler respectively) and include Imp Rovements in performance and stability.

The VC9 builds require you to has theVisual C + + redistributable for visual Studio, SP1 x86 or x64 installed.

The VC11 builds require to has the Visual C + + redistributable for visual Studio, x86 or x64 installed.

This is the official PHP explanation, that is, VC11 corresponding to the Visual C + + Redistributable version of the environment, and VC9 need to c++2008 version of the environment. Pay special attention to this. The wrong version, the subsequent browsing of the PHP page will fail.

VC + + If necessary to install, if there is a corresponding version of the computer, there is no need to consider.

Step Two: Configure PHP. The main configuration is php.ini

The downloaded package is extracted directly to the C:\PHP folder. Copy the Php-development.ini to PHP.ini and make the following modifications (to remove the opening semicolon):

① Modify extension path: Extension_dir = "C:\PHP\ext" (write your actual path here)

② find the part to be extended (possibly more than one), such as: extension = Php_mysql.dll (note here, on-demand cancellation of the previous; comments, not the diagram convenient all cancel, may be error, the author experience ... )

③ time zone: Date.timezone = Asia/shanghai

④fastcgi.impersonate=1 default to 0, if you use IIS, you need to turn on the 1

⑤cgi.fix_pathinfo=1

⑥cgi.force_redirect=0 defaults to 1, and if you use IIS, you need to turn it off to 0

⑦session storage path, such as: Session.save_path = "D:\server\web\session" (write a path to save the session here)

Once the configuration is complete, place a copy of the php.ini into the C:\Windows. When you configure PHP on the Win7 IIS7, you do not need to copy the php.ini and related files to the system directory.

Step Three: Set up IIS. (The installation process does not say, make sure that the CGI module is installed on IIS)

Open IIS, select the site, and open the handler mapping interface.

Click "Add Module Map" in the Right Action tab and configure each option as shown in the figure. Click "Yes" to install the module successfully.

Click on ISAPI and CGI restrictions, click Add, Path to C:\php\php-cgi.exe, describe writable PHP, allow to execute extension path, OK.

Fourth Step: test results

Create a new Web site in IIS, set the port to a port other than 80, for example, 1234, create a new file in the folder under the website index.php, enter

<?  ?>

Set the default page for the site to index.php.

Enter "http://localhost:1234" in the browser, you will see the following screen, to this PHP configuration is successful.

problems that may occur:

Q: "The program can ' t start because msvcr110.dll ..."

The version of A:visual C + + is incorrect.

Q: "Php-cgi.exe Error"

A: This type of error Ten is caused by the configuration of the php.ini. This error can occur in both cases. The direct way to run the PHP folder Php-cgi.exe, if there is a dark bullet box, it is not a problem here. If there are error boxes or other information on the console, follow up further.

Reference article:

Win7 under the fastcgi configuration IIS7 to execute PHP script;

PHP5.4 No Php5isapi.dli configuration

Windows Server 2008 builds PHP runtime environment

Php+mysql Win Deployment

Deploying PHP on IIS 7

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.