Symfony Install and Setup for Windows XP with Apache 2.2

The following is a compilation of notes taken while installing and configuring Symfony for Windows XP with Apache 2.2:

The Process

  • Make sure that PHP is installed, then go to your PHP directory (i.e., C:\php) and double click go-pear.bat.
  • It will ask whether you would like to install a system-wide or local copy, type in “local” and press enter, it will ask you to confirm, type in “yes” and press enter.
  • You should see a list displaying a suggested file layout, press enter and continue.
  • The installer will ask if you would like to “alter php.ini” type in “Y” and press enter.
  • After the installer has completed, open up a command prompt window and go to the root directory (i.e., C:\). You can do this by typing: “cd \”.
  • From the command prompt type: “pear channel-discover pear.symfony-project.com” and press enter. It should tell you “Discover of channel “pear.symfony-project.com’ succeeded”.
  • Now to install symfony, type in:
Pear install symfony/symfony
  • You should see text that says “downloading symfony-1.0.6.tgz” and some loading progress, after the download is completed it will install symfony, and if everything goes well it will say “install ok”.
  • After the installation is complete, navigate to the directory in which you would like to initialize your first symfony project and make sure that it’s within your web root (e.g., C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\symfony).
  • When you’re in your target directory type:
symfony init-project myproject
  • You should see a dump of assets. When it’s complete, type in:
symfony init-app myapp
  • After this is complete, navigate to the directory into which you initiated your symfony project (e.g., C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\symfony) and verify that within the “web” directory that there is an “sf” folder, chances are that folder is nonexistent. You’ll need to navigate to C:\php\PEAR\data\symfony\web\ (or, in my case: C:\php5\pear\data\symfony\web\) and copy the “sf” folder from there into the “web” folder within your install directory. You should be good to go.

Apache 2.2, PHP 5, and MySQL 5 Install and Setup on Windows XP

The following is a series of notes that I compiled while installing and configuring Apache 2.2, PHP 5, and MySQL 5 on Windows XP:

Apache Installation

  • Download Apache HTTP Server (v2.2) from apache website or from mirror, make sure to get a binary file.
  • Run binary file and install Apache.

MySQL Installation

  • Download MySQL Server from dev.mysql.com, do NOT get “essentials” version.
  • It may ask you to login/signup, etc. Just click the link at the bottom: “No thanks, just take me to the downloads”.
  • Run binary and install MySQL.
  • (Optional) Check configuration box and edit configuration settings to your preference.
  • Make sure that MySQL is added to the BIN PATH.

PHP Installation

  • Download PHP 5, be sure to get the ZIP archive and NOT the installer.
  • Extract the archive to c:\php (or your preferred location).
  • After extraction is complete, copy php5ts.dll to C:\Windows\. Make a copy of php.ini-recommended and rename it to “php.ini”; move this file into your C:\Windows\ folder.

Apache Configuration

  • Open your httpd.conf file (C:\Program Files\Apache Software Foundation\Apache2.2\conf) and find the line that looks like:
DirectoryIndex index.html

Change to this:

DirectoryIndex index.html index.php

Feel free to add other extensions as well (e.g., index.htm, index.php5, etc.) if you wish.

  • Find the area in the httpd.conf file that lists the loaded modules (e.g., “LoadModule foo_module modules/mod_foo.so”) and add the following line wherever you wish (i.e., at the beginning, the end, or alphabetical):
LoadModule php5_module "c:/php/php5apache2_2.dll"

Be sure that the path within the quotation marks points to your PHP directory and to the correct DLL file.

  • Find the area that lists the “AddType” declarations (i.e., “AddType application/x-compress .Z” and add the following line at the bottom of that list:
AddType application/x-httpd-php .php

PHP Configuration

  • Open up php.ini (the file you dropped into the C:\Windows\ directory). Find the line that looks like this: “;extension=php_mysql.dll” uncomment the line by removing the semicolon.
  • Add “C:\php” to your PATH environment variable.