Developing with Symfony1.2, NetBeans6.

8, PostgreSQL in WampServer – Part 1
(a) Installing Symfony 1.2.10
1. Please download symfony-1.2.10.zip from http://www.symfony-project.org/installation/1_2 2. Unzip symfony-1.2.10.zip, and paste the folder in your Document Root of WampServer i.e.
c:\wamp\www as following:

3. Now Symfony 1.2.10 is installed on your system. There is no need to install it as pear or svn.
One thing you have to note down is if a version upgrade is there you have to do manually. Please note down this installation is suitable for development purpose only. If you want a production installation then please read ‘Configuring Web Server’ of Chapter 3 and ‘Deploying Applications’ of Chapter 19 of Symfony book http://www.symfonyproject.org/get/pdf/book-1.2-en.pdf.

4. In next step please copy check_configuration.php from C:\wamp\www\symfony1.2.10\data\bin and paste it to your Document Root i.e. C:\wamp\www.

5. Open this file using http://localhost/check_configuration.php as follows:

6. First of all install XSL module by clicking WampServer icon  PHP  PHP extensions 
php_xsl. Restart all Services by clicking WampServer Icon  Restart All Services.

7. Now here I would like to add one thing that if look at php.ini used by
check_configuration.php, it is in C:\wamp\bin\apache\apache2.2.8\bin\php.ini But WAMP has two php.inis. One is in C:\wamp\bin\apache\apache2.2.8\bin\php.ini

and other is in C:\wamp\bin\php\php5.2.6. For execution it took first one and for PHP CLI it took second one. Symfony uses both that’s why you have make extensions of PHP enable in both the ini’s otherwise while executing commands it will give error.

8. Making

changes from WampServer menu only changes in C:\wamp\bin\apache\apache2.2.8\bin\php.ini. but for Symfony we have to make changes to PHP CLI also (i.e. C:\wamp\bin\php\php5.2.6 ). You have to make changes manually. php_pdo_pgsql.dll, php_pgsql.dll and php_xsl.dll) as following:

9. Open C:\wamp\bin\php\php5.2.6\php.ini and remove ‘;’ from front of three DLLs (i.e.

10. Save and Close the file. Restart All Services by clicking WampServer Icon  Restart All
Services as follows:

11. Now your system is ready for development in Symfony 1.2.10.

(b) Installing and Configuring NetBeans 6.8
1. Please download and install Java Development Kit in your system first, then pursue
further in this tutorial. 2. Please download netbeans-6.8-ml-php-windows.exe from http://netbeans.org/downloads/ 3. Double click on netbeans-6.8-ml-php-windows.exe. It will start installing NetBeans 6.8 with following screen:

4. Click on Next button. It will take you to Next screen. Click on ‘I accept the terms…’ and
click on Next button. As given on next screen.

5. It will show you NetBeans installation directory and path to Java Development Kit.
That’s why make sure that JDK must exists on your system before installation of Netbeans.

6. If above options are correct, then click Install button on next screen.

7. It willl start installing NetBeans 6.8 as following:

8. The installation will end with a request for registration. Please register yourself, as it will
provide a lot of information about upgrades and tutorials about using NetBeans. Please click on Finish button.

9. Start NetBeans by clicking NetBeans 6.8 icon. When start NetBeans look like as follows:

10. Please Click on Tools  Options as follows:

11. Click on PHP and See that your PHP CLI is configured. See PHP 5 Interpreter is showing
path i.e. C:\wamp\bin\php\php5.2.6\php.exe as following:

12. Please click on Symfony Tab. Then Click on Browse button and go to path to Symfony
bin directory (i.e. C:\wamp\www\symfony-1.2.10\data\bin) and click on ‘symfony’ script as follows:

13. Click on Open button and then OK button. This will install symfony in your NetBeans. 14. Now create Keyboard shortcuts for Symfony commands and Clear cache. Again click
Tools  Options  Keymap and type ‘run’ in search box and select ‘Symfony: Run Command’ as follows:

15. Click on ‘…’ button next to ‘Symfony: Run Command’ as follows:

16. After clicking Edit menu option, give keyboard shortcut by pressing ‘Alt+L’ from
keyboard for Symfony commands and press OK on following screen.

17. symfony cc is a command that we frequently use to clear cache of symfony project.
That’s why we will create shortcut to that also. Please repeat the process again. This time please type clear cache in Search text box. And give ‘Alt+C’ shortcut to clear cache.

18. Now your NetBeans is ready to create symfony applications.

(c) Creating “Hello World” program using Symfony and NetBeans:
1. Click of File  New Project as follows:

2. Next screen ask you for type of application, Click on PHP and PHP application and
Click on Next button on following screen:

3. Give project name as hello on following screen and click on Next button.

4. Following screen appears, make changes if required and click Next button.

5. On the following screen, Click on ‘Symfony PHP Web Framework’ and give a secret
code in front of –csrf-secret=. As I have given ‘nvne09kmr10sam1976’. Click on Finish button.

6. This will create hello project. The screen for this is as follows:

7. Now click on hello project and press ‘Alt+L’ this will show Run Symfony Command box
as follows:

8. Please type generate in filter text box. It will display commands that start with ‘generate’
in Matching tasks. Please select a task i.e. generate:module from Matching Tasks and type frontend main in Parameters text box, You can see full command in Command text box at the last of command box as follows, press enter on following screen:

9. This command will generate a module ‘main’ in /hello/apps/frontend/modules folder of
hello project as follows. Press ‘Alt+C’ for clear cache.

10. In “main” directory, please open actions directory and then double click on actions.classs.php file it will display contents as follows:

11. Please delete $this->forward(‘default’, ‘module’); line and save the file. It must display like this:

12. Click on indexSuccess.php and Type <h1>Hello World</h1> in it. So that it will look
like as following

13. That’s it your Hello world program is ready. Just open a web browser and give url as
http://localhost/hello/web/frontend_dev.php/main It will display output as

14. If you want to call main module as default module then you have to change some settings
in /hello/apps/frontend/config/routing.yml as follows and clear your cache by pressing ‘Alt+C’:

15. Now you can give only http://localhost/hello/web/frontend_dev.php without modules
name in web browser as you have set default module as main in project.

Sign up to vote on this title
UsefulNot useful