Sunday, February 17, 2008

Installation and configuration of PHP 5 and MySQL 5 on Windows IIS

I spent almost a full day to finally install and configure PHP on my windows system. I am basically a .NET developer and used ASP.NET, C# and MS SQL Server. From that background, configuring PHP with MySQL was a hell. I even tried the installer from php.net website but when it gave the option to choose from list of servers e.g.

IIS CGI
IIS ISAPI
Apache etc etc....

I selected IIS ISAPI and it gave some omnihttpd config error and told to configure manually. A nightmare for a Microsoft tool user :P

I un-installed PHP 5 and downloaded a zip file version from http://www.php.net/. All I did was the following to fix the errors.

Let me first tell you what errors that I was facing.
  • No Input file error while opening php page in a browser
  • MY SQL 5 was not detected when I was trying to install PHPBB3
  • When I executed a test.php file with code, the information screen said that php.ini path is c:\windows and no php.ini file is currently loaded

So, I did the following fix above

  • UnZip php5 in some folder. It is recommended not to uses spaces in folder names. I unzipped in X:\Data\Web\php\php folder.
  • Set user permissions: Give "Everyone" user the "Read and Execute" permissions in C:\windows, the php unzip folder and all of your php virtual directories. Just right click on the folder, select Security, Add user "Everyone" and give "Read and Execute" rights.
  • Set the path of unzip php folder in you system variables path. Right click on "My Computer", go to "Properties", then "Advanced", then "Environment Variables". In "System variables" tab, find "Path" variable and edit it. Append the php path at the end. The paths must be split by semicolons.
  • Copy the php.ini file to c:\windows folder. Now, php will use this as its configuration file.
  • Open php.ini from c:\windows folder and comment the line "doc_root="
  • In php.ini file, set "extension_dir" variable to your "ext" subfolder of php folder. I have set this as extension_dir = "X:\Data\Web\php\php\ext"
  • Set your virtual directory to run php files. Open IIS --> Default Website --> Your PHP virtual directory. This would contain your web application or the php pages that you want to run. Right click the virtual directory, go to "properties", then "Configuration". In "Mappings" tab, press "Add" button. In"Executable" browse for php5isapi.dll from your php unzip folder. In "Extension", give ".php". Remove the double quotes in both text fields, if there are any
  • Restart IIS. A short way of doing is to Start --> Run. Type iisreset.

Don't FORGET to Reset the IIS services.

After performing all the above steps, I executed test.php which has the phpinfo(); function call in it showed the php information screen and showed that php.ini path is c:\windows and currently loaded php.ini file is c:\windows\php.ini.

All this effort just to configure the php correctly........

Now, to configure this for MY SQL 5.0, I did the following steps:

  • In c:\windows\php.ini file, set extensions_dir to your extensions folder. Mine is extension_dir = "E:\Data\Web\php\php\ext"
  • By default, all the extensions in php.ini file are commented. So, uncomment the following 2 lines for MY SQL 5
  • extension=php_mysql.dll
  • extension=php_mysqli.dll
  • Be sure to download the php connectors dlls from http://dev.mysql.com/downloads/connector/php/ and copy them in your php extensions folder. The default ones did not work in my case. Download both MYSQL and MYSQLI and unzip in the extensions folder. My extensions folder in this case is E:\Data\Web\php\php\ext
  • Make sure that MY SQL 5.0 is installed. Download the My SQL Administrator tool to verify that the server is installed and the services are also running
  • Save the php.ini file and reset the IIS services. Use either iisreset command or IIS management console.

After performing the above steps, the phpbb3 install was showing MY SQL and MY SQL with My SQLI extensions both available.

Man!!!! I was so happy to see that green available word.

I thought to post the solution to all the forums that I visited for help, but I forgot which forums I visited. I remember google as the search engine... lolz...

Finally, I thought to post a blog for it for my own records, when I need it later in case of problems. All the best to googlers if you find it and fix your configuration issues.

Tuesday, February 12, 2008

Naruto - My new craze



As long as movies and TV are concerned, I was first addicted to Friends seasons. Now, a friend of mine gave me some episodes of Naruto, a japanese animation series. It seemed stupid first that the characters are talking in japanese and English translation is showing at the bottom. But the story is so great that I am watching it non-stop. One of the best resource for downloading the series is http://www.narutocentral.com/.




Below are the 2 main characters from the animation series.




A must watch if you are a fan of martial arts or ninja. Below is the whole team of the Konoha villiage


Sunday, August 26, 2007

Desert bikes riding on Hatta track

One of the thrilling adventure that can be done in Dubai is the desert motor bike riding. There are several tracks in Hatta for desert safari and motor bikes riding. We did not try the safari yet but enjoyed the riding on bikes alot.

We had to buy the ticket for the driving. Following were the rates and bikes configurations as on August 26, 2007.

1. 250 cc - Automatic - Dhs 200
2. 350 cc - Manual - Dhs 250

There was a special track with boundary for driving the bikes. But we were also allowed to take the bikes outside the boundary area in the desert. We were 4 friends and we rented 2 bikes, 1 manual and 1 automatic. The automatic was very easy to drive. For manual, some motorbike experience is needed. The shifting of gears was similar to the sports bike.

I took the manual one first and took it outside the boundary area. But was not successfull due to the sand. The bike stuck in the sand and the watchers came to help me out. I took it inside the area. There were dunes in the area as well. You can either drive on the straight desert track or have some funs on the dunes. But its dangerous for beginners because if the speed is low, the bike stucks in the sand. And if the speed is high, we experience a free fall after jumping over the dune. It feels like we are flying in the air while jumping. So, you have to be very careful while doing such stunts. Because, I saw a person that fell from the bike and he was not able to stand by himself due to some injury. 3 of us fell too :P. But no serious injuries. Just there were scrathces on the leg. If the bike gets out of control, its much better not to regain its control. Because its in speed and you can fall seriously and roll with the bike. Its better to leave the bike and let it go. Less scratches will come :).

Some precautions and advice:
-- Wear jeans. Dont wear shorts. Because in case of falling, jeans will save your legs from scratches.
-- Get extra piece of cloth. Because after the drive, you will get alot of sand on your body and cloths. There is no facility to shower, so your car can get dirty.
-- Always wear the helmet.
-- Make sure that there is no one on the other side of the dune, in case you are jumping.
-- Ride on manual 350 cc only if you have experience of riding bikes. Its better to check out the automatic bike first and then try out the manual one. Because the manual is so powerfull and it can get out of control easily.
-- Lower the speed when near to the bikes parking area. Because there are people who are taking pictures and some people are starting their bikes to get in the track.

Doing just the acting of falling :P in the above picture.
It was great fun. This was out first time with the desert bikes. 1 hour was more than enough. We felt tired. The wrists felt little pain after riding, because while jumping and doing corners, there is much pressure on the wrists and hands. And there is pressure on the right thumb all the time because we have to use the thumb for accelerator instead of twisting the handle.
Certainly, its one of the best entertainment you can get in Dubai, if you are fond of adventure.

Friday, August 10, 2007

Harry Potter

One day i was bored sitting in my home on a holiday and then visited a book shop and bought Harry Potter and the Philosopher's stone from J K Rowling. She is such a good writer that she really arouse interest while reading the book. I was so impressed with this first book that I bought all the seven books of Harry Potter series and also the DVD movies. Last weekend, I saw Harry Potter 5 on cinema which was released recently. It was cool but compared to the book, its nothing. Personally, I like reading books more than watching movies.

Friday, July 27, 2007

Lal Masjid (Red Mosque) Friday prayers

Faithful people refused to offer jumma (friday) prayers in lal masjid when new khateeb Maula Ashfaq reached there. They enchanted slogans against the government. They wanted to bring back the previous khateeb Maulana Abdul Aziz.

The new Maulana was very dissappointed and refused to accept the imamat of Friday prayers. He also said that he will never lead prayers in lal masjid.

Snooker in F-8 markaz Islamabad

Since I have got a bad habbit of playing billiards with my friends while my stay in UAE, I start searching for some nice billiards or snooker clubs in Islamabad. Then, I came over to a nice snooker club in F-8 Markaz. Although, I played billiards in UAE, but I played snooker there with my cousine. Its harder than billiards but more fun.

Goodbye to table tennis. I also had purchased the table for table tennis, but now I want snooker table in my house.......