How To Install PHP with Apache (Part 2)
Configure PHP
- If you don’t have it on your system, you can download it from here http://windows.php.net/downloads/releases/archives/php-5.3.5-Win32-VC6-x86.zip.
- After download, create a directory named php5 in your C: drive, then extract all its contents to “C:\php5″. It will look like this
- Now locate php.ini-production in C:\PHP5 then rename it to php.ini
- Now open php.ini and locate extension_dir directives, uncomment and change the value into
- Next you need to find output_buffering, in same php.ini file, and change it to
- Now locate php_bz2.dll, php_mbstring.dll, php_mysql.dll, and php_mysqli.dll and uncomment them.
- We are done with the php.ini configuration,
- Now we have to configure the Apache, for this open the apache configuration folder at location C:\Program Files\Apache Software Foundation\Apache2.2\conf which is by default.
- Open the file Httpd.conf, from that folder and make following modifications to it.
- Un-comment expires_module, headers_module, rewrite_module and then add
- Add: (with other AddType block)
AddType application/x-httpd-php-source .phps
- Locate
DirectoryIndex index.html index.htm index.php
- Now Save and close that httpd.conf file.
- Now we need to set enviroment variables. For that….
- Click on Start> Right click My computer Icon> Select Properties> On pop-up window, go to Advaced Tab> Click on environment variables
- Locate Path under System Variables and then double click on it then add
- Further in Environment Variables, next you need to click New Button and then add
Variable value: C:\PHP5
- Click OK>OK to save the settings.
- Now we’re done, let’s begin the test, if all this works or not.
- Go to C:\Program Files\Apache Software Foundation\Apache2.2\htdocs create a new text file inside that directory named test.php (NOTE: Do check the extension, .txt won’t work) and open it with notepad then add this
- Now save all your work and restart your machine.
- After reboot, open up your Browser, and type following in the address:
- If the following page appears, congratulations!!!
0 comments:
Post a Comment