Run PHP and mySQL in IIS!!

13 Sep

I have been going through some challenges since I started analyzing Sugar CRM for my Siemens project. I better call them interesting challenge. After discovering this solution I feel I should share this with my readers. Well main challenge was to run PHP under IIS environment.

I was a little bit tensed about php and IIS server. But this is pretty easy process just to follow some steps…
This is simply some configuration process. I can tell you, I will just forget them once im done configuring 🙂

So let me tell you how I solved this shit…

Fist of all we need the php pack from eher http://www.php.net… Then extract the file and copy in location C:/php

I am using IIS 6.0 and PHP version 5
We will assume in this section that IIS is up and running,
Then follow the below tree…
Click Start
|_ Setting
|_ Control Panel
|_Administrative Tools
|_ Internet Service Manager

Select Default Web Site, right click and select property…

In Home Directory Tab, click Configuration
In the Application Configuration window select App Mappings and click Add Button

Enter the executable as C:\PHP\PHP.EXE (Or the location where you have installed PHP) and the extension as .php as shown in the above figure.

Now copy the php.ini-recommended in windows folder and rename it to php.ini. Edit it if you need necessary change.

For example: To test find out “;extension=php_curl.dll” And remove the semicolon. Then copy php_curl.dll from C:\wamp\php\ext and past it in system32 folder. Now curl lib will enabled with your php.

Configuration not completed yet. You have to include php.ini in our environment variable.
To make it easy right click on my computer properties. Now in advance tab click Environment variable. In system variable section click new or press (ALT + w )
“New system variable “will appear. Now set the following text
Variable name: PHPRC
Variable value: c:/WINNT/php.ini
Reboot the computer.

This is the configurations of IIS to run PHP Files with PHP interpreter.

Now open your favorite text editor and create a text file and type the following code and past in root directory.

And browse the URL. Hope you are getting the necessary information of php.

Now we need the mysql working with php. Let’s have a look there. 🙂

First download mySQL 5.0 and install it like other software. Usually the mySQL installation folder create in C:/ mySQL.

MySQL just installed. But IIS and PHP do not know about it. This is where I had to spend some good amount of time.

Open the MySQL Administrator program. Set server
host = localhost,
username=root
password=123456

Or whatever you set it to. Click on catalogs, if you see “mysql” then that is a main database.

Let’s go to introduce mySQL and PHP.

In the C:\PHP folder copy the file “libmysql.dll” to your C:\WINDOWS\SYSTEM32 folder. Make sure you don’t overwrite any existing file in this folder. If file exists, first rename it so you can go back.

Edit this file “php.ini” that (u kept it in windows directory during php configuration) using a text editor like notepad. Find the line where it says “extension_dir = *something*”. Uncomment this line by removing the preceding semi-colon. and set it to say: extension_dir=”c:\php\ext”

In the same file “php.ini” also un-comment out 2 other lines by removing semi-colon. Find the lines where it says: extension=php_mysql.dll and extension=php_mysqli.dll and uncomment both lines by removing the semi-colon.

Reboot the computer and write some code to access database.

I am thinking to write my next post on about installing SQL Server in IIS.
But till now I am getting an error CGI error

“CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:”

During execution php except validate HTML syntax. Any body have idea pls let know.

Advertisements

3 Responses to “Run PHP and mySQL in IIS!!”

  1. John Persona October 26, 2007 at 5:33 am #

    I am also getting this error for couple of days and still unable to solve it out. Whenever i get the problem solved i will surely share it with you.

  2. Rubel October 27, 2007 at 5:39 am #

    Thank you Mr.John. I solved this probelm using php-win.php in window xp and 2000 server family and php5isapi.dll for windows 2003. It is my pleasure if you share something more with me.
    🙂

  3. Mac M0r0n May 4, 2011 at 10:13 am #

    Thanks, will try this one.

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: