In this tutorial of Symfony 1, we will set up a project from scratch.
Let's start it by downloading the project that you can find on the official web page of Symfony: http://www.symfony-project.org/installation
This tutorial will use the 1.4.12 version.
Once done, come back there.
Just before starting, do not forget that for Windows, you have to use a SLASH (/) and for GNU/Linux a BACKSLAH (\) for you PATH.
And of course, replace yourProjectName by yours.
OK, let's continue.
PHP has to be added to your enviromnent variables. It will be then possible to execute scripts of Symfony with a command line easily.
You can download and install Cygwin for Windows platform, a great tool, as well instead of your classic Windows command line.
Or simply use a Linux distribution.
We admit that your project PATH is:
Dezip your symfony framework in this directory.
We have then to download a test file from a symfony website: http://sf-to.org/1.4/check.php
Place it in your directory.
Open a command line from this directory and write this:
$ php check_configuration.php
Several lines appear preceded by OK or WARNING.
OK means that requirements is OK.
WARNING means that requirements are not OK.
It is up to you to change these settings or not.
Of course the more elements are OK, the more your framework will work correctly.
I suggest to you to fix all except posix_isatty() and PHP accelerator (for a local using, it is not important).
And for Windows, posix_isatty() just does not exist!
To test your symfony version:
$ php data/bin/symfony -V
You can now generate your project:
$ php data/bin/symfony generate:project yourProjectName
It will generate all files and directories needed.
Then create the frontend of your application:
$ php symfony generate:app frontend
Let's configure now the httpd-vhosts.conf file of Apache HTTP for a Windows platform example:
# symfony 1.4.12 / yourProjectName <VirtualHost *:80> ServerName yourProjectName DocumentRoot "C:/www/yourProjectName/web" DirectoryIndex index.php <Directory "C:/www/yourProjectName/web"> AllowOverride All Allow from All </Directory> Alias /sf "C:/www/yourProjectName/data/web/sf" <Directory "C:/www/yourProjectName/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost>
To finish it, go until this adress:
And open the hosts file with a text editor.
Add a line:
Do not forget to restart your Apache HTTP server and that's all!
Try this: http://yourProjectName/
You should normally see the congratulations Symfony home page.
You are now ready to fight the devil!