Thursday, May 21, 2015

Setup WAMP Environment and Create a Symfony Project

To setup a WAMP environment (a web server of Apache, PHP, MySQL in Windows platform), you can install the packages one by one manually, or choose a much easier way: install WampServer.

WampServer is a Windows web development environment. It allows you to create web applications with Apache2, PHP and a MySQL database. Alongside, PhpMyAdmin allows you to manage easily your databases.

WampServer installs automatically all you need to start developing web applications and is very intuitive to use. You will be able to tune your server without even touching the setting files.

Go to the WampServer site to download: WampServer Site

Note:
You might encounter with error "Missing MSVCR100.DLL or MSVCR110.DLL" during the installation of WampServer. It means you need to install Microsoft C/C++ Redistributable runtime libraries. It is available from Microsoft website. The detailed solution is provided here: Missing MSVCRxxx.DLL Thread.

Restart computer after intallation completed. Now I have Apache, PHP, MySQL installed.
Start WampServer: Start --> All Apps --> WampServer --> start WampServer

Try the Web server at a browser with "localhost", or find and click on the WampServer icon in task bar at right bottom corner --> Localhost. Tada! Your WAMP web server is running!

Now I need to create a symfony project.

Go to your project folder, i.e.
cd C:\wamp\www

Note:
To make less typing and make it easier to run php in command line, you can add the location of php.exe to environment variable PATH. (Control Panel-->System and Security-->System-->Change settings-->Advanced-->Environment Variables-->System variables>Path-->Edit, Add ';C:\wamp\bin\php\php5.5.12' at the end of value. Restart Command Prompt to let the new path take effect.

Install symfony:
 ..\bin\php\php5.5.12\php.exe -r "readfile('http://symfony.com/installer');" > symfony 

Create the project:
 ..\bin\php\php5.5.12\php.exe new myProject
Wait a while for Symfony to download the packages and prepare the project. When it's done,
cd myProject
 ..\..\bin\php\php5.5.12\php.exe app\console server:run

Now test the symfony project at browser:
localhost:8000





No comments: