first of all, lets get everything we need downloaded:
- Apache http://httpd.apache.org/download.cgi
- PHP – http://windows.php.net/download. Now, PHP might tell you to download the VC6 for apache – disregard. download VC9 x86 Thread Safe one. do not download an exe or msi file. download the zip archive file.
- mysql server at http://dev.mysql.com/downloads/mysql/. note that there are some other tools in mysql site, you might want to use an overall tool that downloads other things as well.
- Microsoft Visual C++ 2010 Redistributable Package. 32 or 64 bit version (this is for the VC9 version of PHP). BTW, if you have visual studio installed (version 9 or better), you don’t need these packages.
- If you want an editing software for php I recommend netbeans IDE (found in the Favorites links section)
- You Must disable the User account control under Vista/7. Yes, totally disable. This is a horrible tools, which block you from doing your programming. As for viruses? not so much.
- Text editing tool! yes, you can use the IDE editor, but I like to have a fast one that can edit any text file. you can find some in the favorites page.
all the instructions below assumed that you use the default locations and installations.
Now, install Apache. note: if you do use Skype, make sure to disable listening on port 80. go to http://127.0.0.1. you should see a “It works!” message.
Next – PHP. you need to stop Apache server for the actual setup (later).
- extract all the files to a well known location. c:\php is the usual place, you can change it, but for now this will do.
- C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf is where you will find your httpd.conf file. this is a text file, you can use any editor, I will recommend notepad++ for this job.back this file upbefore changing it! Open this file and you need to add three line (I’m doing that after the “LoadModule” part is all done):first line LoadModule php5_module “c:/php/php5apache2_2.dll” will tell Apache where to look for the module note the reverse slash, unlike windows. VERY IMPORTANT to see that the apache version matches the dll version. make sure you are downloading version 2.2 and above! next line, AddHandler application/x-httpd-php .php will tell Apache about this new php type. and last one, PHPIniDir “C:/php” will show Apache where to find your configuration file which is php.ini. Save this file and restart Apache.
- Now, your documents folder can be found in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs you should see a file named index.html. right click in this folder and create a new file, named pi.php. edit this file with your favorite text editor, to have the next code:
<?php phpinfo(); ?>
Now, go to http://127.0.0.1/pi.php, you should get the php information page. If you do, you configure php correctly.
- in C:\php you will find 2 php.ini files php.ini-development and php.ini-production. go on and rename php.ini-development to php.ini. restart apache server. now, go to http://127.0.0.1/pi.php, you should see that the Loaded Configuration File is pointing to the right ini file.
- now, let edit the php.ini file. first look for extension_dir and make sure that it is pointing to the right location: C:\php\ext. next, un-remark all the extensions (look for extension ) mentioned here: php_bz2.dll, php_gd2.dll,php_mbstring.dll and anything with mysql in it. you can choose more extensions if you like like exif or any other. Next thing – if you want users to be able to upload stuff to your site (users are also including you if you are using any php application for your site like drupal) need to go to update the following settings for this: post_max_size, upload_max_filesize. Any change in php.ini will require restarting Apache.
- go on and go to http://127.0.0.1/pi.php. look for mysqli. found it? you are all set!