PHP / Personal Home Page / PHP Hypertext Preprocessor
PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in standalone graphical applications.
You need to configure the FastCGI module and PHP to host PHP application on IIS 7.0 , I prefer FastCGI module and manually configuring it because when you search for help on the net , the easiest thing which I could grasp easily was this inbuilt service in Windows by Microsoft and this is more preferable than using a WAMP because , you will have lots of problems like searching for the default directory , setting permissions ,etc and believe me its not an easy task just googling for answers and applying it on your PC !!
Overview
--------------
CGI programs are executables launched by the web server for each request in order to process the request and generate dynamic responses that are sent back to the client. Because many of these frameworks do not support multi-threaded execution, CGI enables them to execute reliably on IIS by executing exactly one request per process.
FastCGI addresses the performance issues inherent in CGI by providing a mechanism to reuse a single process over and over again for many requests. Additionally, FastCGI maintains compatibility with non-thread-safe libraries by providing a pool of reusable processes and ensuring that each process will only handle one request at a time.
Windows Vista SP1 or Windows 7
--------------------------------------------
Add the CGI feature by going to Control Panel -> Programs and Features -> Turn Windows features on or off. Do as shown below :
Go to Internet Information Servises -> World Wide Web Services ->
Select : - Application Development Features ,
Common HTTP Features ,
Health and Diagnotics ,
Security.
Go to Internet Information Servises ->Web Management Tools ->
Select : IIS Management Console
Install and configure pHp----------------------------------
It is recommended to use a non-thread safe build of PHP with IIS 7.0 FastCGI. A non-thread safe build of PHP provides significant performance gains over the standard build by not doing any thread-safety checks, which are not necessary, since FastCGI ensures a single threaded execution environment.
- Download the latest non-thread safe zip package with binaries of PHP from http://www.php.net/downloads.php.
- Unpack the files to a directory of your choice (e.g. C:\PHP).
- Rename the "php.ini-recommended" in C:\PHP to "php.ini".
- Set the Extension dir by uncommenting extension_dir and adding in front of it= "c:\php\ext" . Finally you get extension_dir = "c:\php\ext"
Uncomment :
extension=php_mssql.dll extension=php_mysql.dll
Add at the end :
fastcgi.impersonate = 1
cgi.fix_pathinfo=1
cgi.force_redirect = 0.
- To test if the PHP installation is successful, run the following from the command line prompt: C:\PHP>php –info
Configure IIS 7.0 to Handle PHP Requests
------------------------------------------------------Go to Control Panel -> Administrator Tools -> Internet Information Services (IIS) Manager.
Open IIS Manager and then select and open “Handler Mappings” at the server level.
Select the “Add Module Mapping” action and specify the configurations settings as below:
------------------------------------------------------Go to Control Panel -> Administrator Tools -> Internet Information Services (IIS) Manager.
Open IIS Manager and then select and open “Handler Mappings” at the server level.
Select the “Add Module Mapping” action and specify the configurations settings as below:
- Request path: *.php
- Module: FastCgiModule
- Executable: "C:\PHP\php-cgi.exe"
- Name: PHP via FastCGI
Click OK. A dialog box appears asking if you want to create a FastCGI application for this executable. Click Yes.
Test that the handler mapping works correctly
--------------------------------------------------------------
Open Notepad
Write the code :
Save as "phpinfo.php" in C:\inetpub\wwwroot
Open a Browser , Give the url as "http://localhost/phpinfo.php"
If everything works fine you will get a table of information like :
Ya Hoo !!! The PHP server is set ..... GET ........ SET ......... COOOOOOOOODE !!!
Test that the handler mapping works correctly
--------------------------------------------------------------
Open Notepad
Write the code :
Save as "phpinfo.php" in C:\inetpub\wwwroot
Open a Browser , Give the url as "http://localhost/phpinfo.php"
If everything works fine you will get a table of information like :
Ya Hoo !!! The PHP server is set ..... GET ........ SET ......... COOOOOOOOODE !!!
How to install XAMPP
XAMPP is an easy-to-use multi-platform package that installs Apache, MySQL, PHP, phpMyAdmin, and a whole slew of other software useful for dynamic web development on your computer. Installation is painless, and configuration minimal. This page guides you through installing the package on both Windows and Mac OS X. You can also read general notes about using XAMPP.
1. Go to http://sourceforge.net/project/showfiles.php?group_id=61776 and click "XAMPP Windows". If necessary, click the "1.7" link to expand the appropriate version, and choose to download xampp-win32-1.7.0-installer.exe.
The XAMPP Control Panel in Windows
The XAMPP Control Panel in Windows
2. Run the installer. If you want, you can choose to install the Apache and MySQL servers as services, which will make them start automatically every time you start Windows. If you don't choose this option, you will need to use the XAMPP Control Panel application to start the servers individually each time you need them. This may be desirable if you don't intend to use your servers that often.
3. Upon completion of installation, the XAMPP Control Panel will open (if not, click Start » All Programs » Apache Friends » XAMPP » XAMPP Control Panel). This tool lets you start and stop the various servers installed as part of XAMPP.
4. Start Apache and MySQL by clicking on the "Start" buttons next to each item. If prompted by Windows Firewall, click the button labelled "Unblock".
5. Go to http://localhost/. If you are directed to a page with the XAMPP logo, your installation was successful. Congratulations!
You can add or change the files in C:\xampp\htdocs to change what you see at http://localhost/ on any local web browser. You may need to delete index.php in that directory to stop the server from automatically redirecting you to the XAMPP configuration interface.
Here are the locations of some configuration and log files you may want to view or change:
Type | Location |
Apache configuration | C:\xampp\apache\conf\httpd.conf,C:\xampp\apache\conf\extra\*.conf |
Apache logs | C:\xampp\apache\logs\access.log,C:\xampp\apache\logs\error.log |
PHP configuration | C:\xampp\php\php.ini |
MySQL configuration | C:\xampp\mysql\bin\my.cnf |
The XAMPP Control Panel in Mac OS X
2. Choose to download xampp-macosx-0.7.4.dmg.
3. Double-click the Disk Image file you just downloaded.
4. In the window that opens, double-click XAMPP for MacOS X.pkg.
5. Once installation completes, go to your Applications folder, and go inside the xampp folder inside.
6. Double-click on XAMPP Control Panel. This tool lets you start and stop the various servers installed as part of XAMPP.
7. Start Apache and MySQL by clicking on the "Start" buttons next to each item. Note that you will need to repeat these steps if you reboot your computer and wish to use Apache and/or MySQL.
8. Go to http://localhost/. If you are directed to a page with the XAMPP logo, your installation was successful. Congratulations!
You can add or change the files in /Applications/xampp/htdocs to change what you see at http://localhost/ on any local web browser.
Here are the locations of some configuration and log files you may want to view or change:
Type | Location |
Apache configuration | /Applications/xampp/etc/httpd.conf,/Applications/xampp/etc/*.conf |
Apache logs | /Applications/xampp/xamppfiles/logs/access_log,/Applications/xampp/xamppfiles/logs/error_log |
PHP configuration | /Applications/xampp/etc/php.ini |
MySQL configuration | /Applications/xampp/etc/my.cnf |
Note that "localhost" (often resolving to the reserved IP address 127.0.0.1) is a special name defined in the DNS system as a name that a host uses to reference itself, using the loopback interface. URLs that refer to "http://localhost/" can only be used on the system with XAMPP installed. However, by default, XAMPP configures Apache to allow connections from outside your system, so people on your network, or in some cases users from anywhere in the world, may be able to access your Apache-served files using your IP address.
You can go to http://localhost/phpmyadmin/ to use the locally-installed copy of phpMyAdmin, a tool useful for manipulating your MySQL databases in a graphical environment.
On the Windows version of XAMPP, you can use the command-line interface (CLI) version of PHP at C:\xampp\php\php.exe. On Mac OS X this is located at /Applications/xampp/xamppfiles/bin/php. If you want to be able to execute PHP by simply typing "php" at the command line in either operating system, you need to add the directory containing PHP (C:\xampp\php on Windows and /Applications/xampp/xamppfiles/bin on Mac OS X) to your "path" variable. There are tutorials available for doing this on Windows and on Mac OS X.
If you want to fine-tune your Apache, MySQL, or PHP settings, you can go to http://localhost/xampp/ to view and change parts of your XAMPP configuration. If you are feeling especially adventurous, you can also hand-tweak the configuration files in the XAMPP installation directory.
Note that XAMPP may tell you that PHP is insecure because it is not running in "safe mode". However, PHP's safe mode feature is considered a broken security measure (and has been removed in the next version, PHP 6.0) and should not be enabled.