Development

HowToInstallSymfonyOnWindowsWithWamp

You must first sign up to be able to contribute.

How to install Symfony on Windows with WAMP

This tutorial is the continuation of How to install PEAR on windows with WAMP, in addition it is made with Symfony version 1.0.6. The first steps that I will make will be very similar to as it is in the official page to install via PEAR in linux.

1. Open the command prompt - Start / Run / cmd.

2. Type the following:

3. After PEAR adds the new channel, type the following:

4. After symfony is downloaded and installed, browse to the folder "C:\wamp\php" (or "C:\wamp\bin\php\php5.2.5" with the latest version of WAMP: WampServer 2), and look for the file "symfony.bat" and copy.

5. Then browse to the folder, "C:\WINDOWS\system32", and paste.

6. While in System32 open the file symfony.bat with an editor such as notepad++ and edit line number 25, so it is similar to the following:

rem %PHP_COMMAND% -d html_errors=off -d open_basedir= -q "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
%PHP_COMMAND% -d html_errors=off -d open_basedir= -q "C:\wamp\php\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9

or with the latest version of WAMP: WampServer 2

rem %PHP_COMMAND% -d html_errors=off -d open_basedir= -q "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
%PHP_COMMAND% -d html_errors=off -d open_basedir= -q "C:\wamp\bin\php\php5.2.5\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9

rem Batch is used for comments.

Replace "C:\wamp" and "C:\wamp\php\symfony" (it is the file without an extension), so it is the actual path on your machine and it should be the same as in the previous tutorial.

Now, while in symfony.bat modify line number 35, so that it points to the file php.exe, similar to the following:

set PHP_COMMAND=C:\wamp\php\php.exe

or with the latest version of WAMP: WampServer 2

set PHP_COMMAND=C:\wamp\bin\php\php5.2.5\php.exe

Save and close the file.

The modified file should be similar to the following.

@echo offrem *************************************************************
rem ** symfony CLI for Windows based systems (based on phing.bat)
rem *************************************************************rem This script will do the following:
rem - check for PHP_COMMAND env, if found, use it.
rem   - if not found detect php, if found use it, otherwise err and terminateif "%OS%"=="Windows_NT" @setlocalrem %~dp0 is expanded pathname of the current script under NT
set SCRIPT_DIR=%~dp0goto init
:init
if "%PHP_COMMAND%" == "" goto no_phpcommand
IF EXIST ".\symfony" (
%PHP_COMMAND% -d html_errors=off -d open_basedir= -q ".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
) ELSE (
rem %PHP_COMMAND% -d html_errors=off -d open_basedir= -q "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
%PHP_COMMAND% -d html_errors=off -d open_basedir= -q "C:\wamp\php\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
)
goto cleanup
:no_phpcommand
rem echo ------------------------------------------------------------------------
rem echo WARNING: Set environment var PHP_COMMAND to the location of your php.exe
rem echo		  executable (e.g. C:\PHP\php.exe).  (assuming php.exe on PATH)
rem echo ------------------------------------------------------------------------
set PHP_COMMAND=C:\wamp\php\php.exe
goto init
:cleanup
if "%OS%"=="Windows_NT" @endlocal
rem pause

or with the latest version of WAMP: WampServer 2

@echo offrem *************************************************************
rem ** symfony CLI for Windows based systems (based on phing.bat)
rem *************************************************************rem This script will do the following:
rem - check for PHP_COMMAND env, if found, use it.
rem   - if not found detect php, if found use it, otherwise err and terminateif "%OS%"=="Windows_NT" @setlocalrem %~dp0 is expanded pathname of the current script under NT
set SCRIPT_DIR=%~dp0goto init
:init
if "%PHP_COMMAND%" == "" goto no_phpcommand
IF EXIST ".\symfony" (
%PHP_COMMAND% -d html_errors=off -d open_basedir= -q ".\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
) ELSE (
rem  %PHP_COMMAND% -d html_errors=off -d open_basedir= -q "%SCRIPT_DIR%\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
%PHP_COMMAND% -d html_errors=off -d open_basedir= -q "C:\wamp\bin\php\php5.2.5\symfony" %1 %2 %3 %4 %5 %6 %7 %8 %9
)
goto cleanup
:no_phpcommand
rem echo ------------------------------------------------------------------------
rem echo WARNING: Set environment var PHP_COMMAND to the location of your php.exe
rem echo		  executable (e.g. C:\PHP\php.exe).  (assuming php.exe on PATH)
rem echo ------------------------------------------------------------------------
set PHP_COMMAND=C:\wamp\bin\php\php5.2.5\php.exe
goto init
:cleanup
if "%OS%"=="Windows_NT" @endlocal
rem pause

7. Return to the command prompt and type "symfony" (without the quotes), if everything was done correctly, all the Symfony commands used in the CLI will appear in the command prompt.

8. Finally, get the latest updates for PEAR and Symfony using the command:

pear upgrade-all

Or refer to installation of symfony

It is recommended when you update your packages PEAR or Symfony you should also update the archives pear.bat and symfony.bat in the System32 folder, so the CLI (Interprets of line of commands) is correctly updated.

Good Luck :)

Contacts

* Pedro Hernández (phpleo [at] gmail [dot] com ), http://blog.phpleo.com/

Acknowledgments

* dustintownsend (Revisions in the translation)

Attachments