Install apache and php on Windows

The following instructions are for installing apache and php on Windows XP:

  1. Download the apache msi from the apache website
  2. Run the msi, you can use localhost for the Domain and Server.  The admin email can be what you like
  3. If you choose the default install dir, the files will be placed at C:\Program Files\Apache Software Foundation\Apache2.2
  4. By defualt the "home" directory is htdocs
  5. If you are running IIS on the same server, it will be using port 80, so you need to change apache to use another port to do this edit the conf\httpd.conf file:

    Listen 8000

    ServerName localhost:8000

  6. Restart apache, then you should be able to browse to http://localhost:8000
  7. If you want to change the home directory edit httpd.conf:

    DocumentRoot "C:\All\htdocs"

    and change the <Directory...> to
    <Directory "C:/All/htdocs">

  8. Next for the php install, download the latest php zip file (I downloaded php-5.2.8)
  9. Unzip to program files\php-5.2.8
  10. Copy php.ini.dist to C:\Windows and rename to php.ini
  11. Now we configure apache to run php
  12. Copy php5ts.dll to the bin dir under your apache install directory
  13. Edit http.conf to include:

    LoadModule php5_module "C:/Program Files/php-5.2.8/php5apache2_2.dll"
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

  14. Restart apache
  15. Create a file in your home dir (by default htpdocs) called info.php and add:

    <? phpinfo(); ?>
  16. Browse to http://localhost:8000/info.php and you should see your system info

Ruby on Rails Mysql::Error: Unknown system variable 'NAMES': SET NAMES 'utf8'

If you receive the following error message Mysql::Error: Unknown system variable 'NAMES': SET NAMES 'utf8' when trying to run MySQL with ruby on rails it may be due to the version of MySQL you are running.  I was receiving this error when running a basic ROR app as well as when trying to run a migration rake db:migrate.

Turns out I was using MySQL version 4.0.12-nt which is not supported with the most recent version of rails. 

 I had MySQL 5.1 running on a different port, so I also needed to update the database.yml file to specify the port.  If you need to specify a MySQL port with rails, you need to add port: to the yml file...mine ended up looking like: 

  host: localhost
  port: 3307

 With those changes in place, I was then able to run my rails app and migrations.

Your PHP installation appears to be missing the MySQL extension which is required by WordPress

I was recently setting up WordPress to run locally on my development machine and when I tried to browse to the WordPress homepage locally, I recieved the error:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

My configuration:
Windowx XP
Apache 2.2
php-5.2.8
MySQL 5.1

To correct this issue, I did the following:

  1. In the Php.ini file (on my machine this is located at C:\Windows):
    Set extension_dir = "C:/Program Files/php-5.2.8/ext" (where php is installed on my machine)
  2. uncommented (remove ;)
    extension=php_mysql.dll
    extension=php_mysqli.dll
  3. Copied libmysql.dll from php dir to system32 (C:\WINDOWS\system32 on my machine)

Hope that helps anyone with a similar issue.