Symfony and WAMP 2.4 windows installation

To work with Symfony, many people recommend to install every thing as a separate entity; PHP, Apache and MySQL. But sometimes the reality is different and you just need to use what you need to use. That was my case. I had WAMP Server 2.4 working for WordPress and I neded to install a Symfony 2.4 project, no option. So I decided to just meet the Symfony dependencies and install it. Then I created a cert of manual or how to? to help to guide others that might have the same problem. Also you might want to do it because of some other reason, but that was my reason. I was requested to do it like that and only like that. And in my country we have a saying that teaches something like this. If someone wants something even if it is a bad thing; don’t give him other thing. Of course I do not mean that WAMP or Symfony together are a bad thing. This is what I have done:
Software to install:

  • WAMP Server 2.4.
  • Symfony Requirements
  • Symfony 2.4

Note: this post is about installing Symfony in windows with wamp if you work with Linux you can use this material. and if what you want is to move an app from development to a production environment, you need to do this.

 

WAMP Server 2.4

WAMP Server 2.4

1- Install WAMP server 32 bits.

Get wamp from here. Because of some incompatibilities with some versions of cache accelerators for php 5.4 64 bits it’s preferable to install the WAMP server 32 bits version. I have had problems to make the 64 bits work, but I can not 100% confirm it was because of incompatibility. I have installed wamp 32 bits latest version in: D:\Web\wamp. You can install it where ever you want, even the default path is a nice place for most people.

Before installing wamp you need to make sure you have installed Microsoft Visual C++ 2010 Redistributable, if you do not have it you can get the the version for 32 bits Windows from here,  and for 64 bits from here.

The installation process goes straight forward normally is a next-next matter. Once you are done you can start the service straight away and test it by writing in your browser address bar:

http://localhost

Check out the picture.

2- PHP ssl module working

we need to install Composer the tool recommended and that we will use to download Symfony from the prompt. Composer recommends to have the  php ssl module working. To do that we need to edit the php.ini for cli as when you enter commands in the prompt the system does not run the commands through Apache, so is the cli php.ini the one we need to edit. So edit the php.ini in Your\installation\path\php\php5.4.12\php.ini (the php version might change depending on the version of WAMP). On the file go to the extensions section and remove the ; from the extension for ssl.

extension=php_openssl.dll

This let’s composer run secure PHP connections from the prompt.

3- Instal composer.

Follow the website installation instructions for Windows.

4- Environment variables.

Activate environment variable for PHP, MySQL and Composer once you install it. add to the environment variable called PATH the path to your PHP, MySQL and Composer.

Environment variables for Symfony

Environment variables for Symfony

To edit the system PATH environment variable:

  • Right-click on My Computer/Computer and select Properties
  • Select the Advanced system settings tab in the advanced dialog that appears
  • Click on the Environment Variables button
  • Locate PATH in the System variables list
  • Click Edit and add your directories containing the binaries separated by ; mine looks like this:

C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Java\jre7;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64rogram Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64:\eSuppo৪睗孔\蚰ȯer\Software\MEI\Intel\[AxP][X750JA_X750JB]_Intel(R)_Management_Engine_Components\Vista32_Vista64_Win8_32_Win8_64_9.0.0.1287\Drivers\MEI\HECIᬀ嬱哈ȱ㵸\lags 20 -keypath “Software\Intel\Difx64”;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Web\wamp\bin\php\php5.4.16;C:\ProgramData\ComposerSetup\bin;D:\Web\wamp\bin\mysql\mysql5.6.12\bin5-

The last part of this I what I have added, but every case might be different depending on your own path to the binary files:

...;D:\Web\wamp\bin\php\php5.4.16;C:\ProgramData\ComposerSetup\bin;D:\Web\wamp\bin\mysql\mysql5.6.12\bin5-

If you look closer there is a ;  between every path that I specify. And the path is just the route to the executable files of the software that you want to be declared in your environment.

Note: Wamp’s php comes with a xdebugger version (a symfony requirement) so it does not need to be installed.just edit the nesting level. to do that update Apache’s php.ini and set the xdebug.max_nesting_level to 250:

zend_extension = "D:/Web/wamp/bin/php/php5.4.16/zend_ext/php_xdebug-2.2.3-5.4-vc9.dll"
[xdebug]
 xdebug.remote_enable = off
 xdebug.profiler_enable = off
 xdebug.profiler_enable_trigger = off
 xdebug.profiler_output_name = cachegrind.out.%t.%p
 xdebug.profiler_output_dir = "D:/Web/wamp/tmp"
 xdebug.max_nesting_level = 250

In normal conditions you will only have to add the last line.

5- Install a cache manager extension.

Normally you can install APC (http://dev.freshsite.pl/php-accelerators/apc/file/details/apc-3114-beta-for-php-54-win72008.html) or Opcache (http://dev.freshsite.pl/nc/php-accelerators/zend-opcache). I have decided to install APC if you have any newer PHP version 5 or newer Opcache is recommended as the default PHP acelerator even incorporated in the default installation.

To install APC, first copy the file to the extension_dir (you can find it in your php.ini).

Then add the following to the php.ini file.

extension=php_apc_3114_beta_php54_win7-2008.dll

where php_apc_3114_beta_php54_win7-2008.dll is the name of the apc dll downloaded from the URL, and it´s copied in the folder php/ext as I mentioned before.

If you want Symfony to use Opcache for this version of PHP, it should be something like this in you php.ini file.

;Opcache Extension for symfony
zend_extension = "D:\Web\wamp\bin\php\php5.4.12\zend_ext\php_opcache_703_php54_vc9.dll"
[opcache]
opcache.enable = 1
opcache.memory_consumption = 300
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 8000
opcache.fast_shutdown = 1
opcache.enable_cli = 1
opcache.use_cwd = 1

Taken from: https://coderwall.com/p/0sadqa

As we also have Xdebugger by default in WAMP we need to put the configuration before the xdebugger configuration in order for it to work otherwise it will not load.

Taken from: http://www.php.net/manual/en/opcache.installation.php

6- Activate other PHP modules

I recommend these if they are not already active to be active in yout php.ini:

extension=php_intl.dll
extension=php_mbstring.dll
extension=php_pdo_mysql.dll

But also you might need some other like:

extension=php_curl.dll
extension=php_pdo_sqlite.dll
extension=php_fileinfo.dll

7- download and deploy de Symfony framework.

-Open a command prompt and load the path to the install files, normally something like c:/wamp/www/project or in my case D:\Web\wamp\www\combi.

-Open your command prompt (CMDor any other you prefer) and load the folder where you have installed. Have the forder for your project to do that you can use the commands cd, mkdir, etc.

-Execute the command:

composer create-project symfony/framework-standard-edition path/ 2.4.2

Taken from: http://symfony.com/download

Note: If you are behind a proxy server you have to set and environment variable to say who is the proxy and how to authenticate. open a terminal and write something like this:

SET HTTP_PROXY=http://username:[email protected]:8080
SET HTTPS_PROXY=http://username:[email protected]:8080

Remember to change the parameter to fit in your network. username, password,proxy server name and domain or IP and the proxy port.

Symfony config check

Symfony config check

And that is it. We are done after the download is finished you can check that every thing is working. To do that put the following in the browser or at least something similar:

 http://localhost/combi/path/web/config.php

Under normal circumstances if everything went well you should get something like the picture, otherwise, review the step corresponding to the problem.

Thank you!

Main reference.

4 comments on “Symfony and WAMP 2.4 windows installation
  1. Frank says:

    Hi, I love your posts, please keep writing!

  2. abel says:

    Thank you!

  3. Alex says:

    Great Post. It was really useful.

    But I had some issues. I installed a wampserver 2.4, 64 bits.
    I managed to solve them, so just wanted to share my finding in case someone else has the same issues:

    [APC] I had the following error message “PHP Startup: Unable to load dynamic library ‘D:/…/ext/php_apc.dll’ – %1 n’est pas une application Win32 valide.”
    To solve it I downloaded another apc dll here for 64bits :
    http://blog.nicolashachet.com/technologies/php/installer-le-bon-php_apc-dll-sous-windows-7-x64-et-corriger-les-erreurs/
    http://www.mediafire.com/php-win64-extensions

    [php.ini] In Wamp there are 2 php.ini files. One in the “\wamp\bin\php\php5.4.12” and one in the “\wamp\bin\apache\Apache2.4.4\bin”. I was working with the php folder one but it was not working. I had to modify the apache one.

    Hope it can help someone.
    Thanks again.

    • abel says:

      Hi, thank you for the comment Alex.
      I did the same thing as you, installed a 64 bits Wamp at the beginning, but I could not manage to find your appreciated and useful link to the APC for 64 bits. So I could not get ride of the error that you are showing in French. Besides “je ne parle pa françe!”, Any way if I have the time, I’ll try to follow it.
      About the php.ini, there is one that is for Apache, that is the one inside Apache folder. The other one is to use it for the cli extension, it let you create php scripts that run outside Apache for instance in the shell when you call “php -i” so what you add to this php.ini inside the PHP folder is not added to Apache.
      About CLI: http://commons.apache.org/proper/commons-cli/
      Thank you for your very smart discovery.
      Abel

Leave a Reply

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

*