Skip to content

How to install php on Windows 2012 Server?

May 13, 2016

This is a fast guide to get your php running. I won’t be explaining why you need to do this and why you need to do that. You can google it to learn more.

1: On Server Manager, start power shell and  run this command:

  • import-module servermanager
  • add-windowsfeature web-cgi

Check for any error message, if you are running on Shared Configuration, you might need to disable it first.

2: Download php here :

http://windows.php.net/download/

You need to download vc14 x64 non-thread safe version.

3: Extract the php zip file to c:\php .

4: The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed. Go ahead and install , it is mandatory.

5: Launch IIS manager.

6: Select the web server you want to edit, on the features view double click on Handler Mappings.

handlermap1

7: Click on Add Module Mapping.

handlermap2

8: Enter as follow. Make sure the file extension is exe and not dll.

handlermap3

9: Click on Request Restrictions and select mapping>Invoke>File.

handlermap4

10. Click OK few times and close all dialog boxes.

11:  Goto c:\php and make a copy of the file php.ini-production. Name it php.ini

12: Add this to the php.ini

extension_dir = “ext”
cgi.force_redirect = 0
cgi.fix_pathinfo=0
fastcgi.impersonate = 1

13: Save the file.

14: Restart IIS and app pool

Now, it’s time for test.

15: Open notepad, copy and paste this, name this file index.php

<?php phpinfo(); ?>

16: copy this file to a test or dummy site.

17:   Open your browser and type your test/dummy url , for example:

stones.cwp.local/index.php.

18, If successful, the site will look like this:

php_result

19: That’s all folks !! Hope this very fast guide is useful to you !  If there is any error, make sure your permission is set correctly, for example in anonymous authentication, are you using App Pool Identify?

 

 

 

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: