How To Install Your Own Web Server - Installing PHP

June 4th, 2008 · 1 Comment

PHP On Windows TutorialIn the third part of this tutorial, we’re now going to install PHP 5 on Windows.

In the two previous posts, we’ve seen how to install Apache and MySQL on a Windows computer so you you should already have a working web server and database server.

How To Install PHP5 On MS Windows

  1. Head over to http://www.php.net and download the latest version of PHP from the “Downloads” section. From the Windows Binaries, get the zip package, not the installer. The latest version at the time of this writing is PHP 5.2.6.PHP5 Windows Tutorial
  2. Extract the content from the archive into C:\PHP (or wherever you want to install PHP but at the root of your hard drive the preferred location).PHP5 Windows XP Tutorial
  3. Using Notepad (or any non-formating text editor) open Apache’s configuration file (c:\Apache2\conf\httpd.conf)
  4. Find the section where modules are loaded and insert the following lines:
    LoadModule php5_module "c:/php/php5apache2.dll"
    AddType application/x-httpd-php .php
    PHPIniDir "C:/php"
  5. Now find the DirectoryIndex parameter and index.php so it looks something like this:
    DirectoryIndex index.php index.html index.html.var
  6. Save and close the httpd.conf file.
  7. Copy c:\php\libmysql.dll and c:\php\libmcrypt.dll to c:\windows\system32
  8. Using Windows Explorer, find the file named php.ini-recommended in C:\PHP and rename it to php.ini (ie.: c:\php\php.ini).
  9. Open php.ini with Notepad.
  10. Uncomment the line that begins by “include_path” under the Windows comment.
    ; Windows: "\path1;\path2"
    include_path = ".;c:\php\includes"
  11. Find the extension_dir parameter and set it to:
    extension_dir = "c:/php"
  12. Find the mysqli extension parameter and uncomment it:
    extension=php_mysqli.dll
  13. Do the same thing for extension=php_mbstring.dll and extension=php_mcrypt.dll
  14. Right-click on My Computer and select Manage. Restart the Apache2 service as shown below.Windows PHP Tutorial
  15. Using Notepad, create a new file and insert the following content:
    <?php phpinfo(); ?>
  16. Save this file to c:\Apache2\htdocs\phpinfo.php
  17. Open your web browser at http://127.0.0.1/phpinfo.php
  18. If everything went correctly, you should see the PHP information page:

You now have a functional web server with PHP and MySQL support running on your Windows computer!

But it’s not over yet. We still need to do a few things:

  • Create a MySQL database and a database account
  • Create a virtual host
  • Install phpMyAdmin so you can manage your database content and structure

Stay tuned, I’ll be posting the final part of tutorial soon.

Click here to subscribe in a RSS reader or to receive email updates.

1 response so far ↓

1. Response by : How To Install Your Own Web Server - Adding A Virtual Host on Jun 10, 2008 at 5:13 am

[...] Restart the Apache2 service (Don’t remember how? See step #14 from this post). [...]

Leave a Comment




Posted in Apache · MySQL · PHP · Tutorials · Windows Server | 1 Comment

Dedicated Servers
 
VPS
Website Hosting
 

Recent Comments

Recent Webmasters

Hosting Type :
Monthly Price :
Storage :
Transfer :
Sort By :