How to Configure Apache + PHP + MySQL in Windows

Install PHP

Download PHP5, extract it, and copy php.ini-dist to php.ini in the PHP5 root directory.

  • Edit php.ini. change the line doc_root = "X:\yy\web\". X:\yy\web\ is your webpages' root directory.
  • delete the "#" before the
    extension=php_gd2.dll,
    extension=php_gettext.dll,
    extension=php_mysql.dll

Install Apache

Download Apache, install it. then you should edit the httpd.conf:

  • add the line
    LoadModule php5_module X:/PHP5/php5apache2.dll
    under the LoadModule... line.
  • find the line ServerName..., change the servername to your domain name. If you haven't a domain name, you can set it to your IP address, or you set it as ServerName 127.0.0.1:80, the "80" is the port. Then your computer can provide a web service.
  • find the line DocumentRoot..., set it to your webpages' root directory, like DocumentRoot "X:/yy/web".
  • you should find the line <Directory "default directory">, Change it as <Directory "X:/yy/web">,the X:/yy/web is your webpages' root directory.
  • find the line
    DirectoryIndex index.html index.html.var,
    add index.php to the end.
  • add the line ScriptAlias /php5/ "X:/PHP5/".
  • add the line
    AddType application/x-httpd-php5 .php.
  • add the line
    Action application/x-httpd-php5 "/php5/php-cgi.exe".
  • add the line PHPIniDir "X:/PHP5/".

Install MySQL

Download MySQL 5.0, install it. When installing finished, the configureation wizard start, you should note the following:

  • If you want to connect your database remotely, you should choose "Enable TCP/IP Networking";
  • If you want to contain universal characters to your database, you should choose "Best Support For Multilingualism";
  • check "Install As Windows Service", and "Launch the MySQL Server automatically" if you want to do it.
   Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.