Hayling Island Internet Marketing and Technology Blog

£300CMS

A Content Management System can give you the power to control the content on your web site. Our CMS is a fully featured mature piece of professional software it also comes with a remarkable price tag.

  • A custom designed template
  • Edit your content
  • A web form

 

Contact us now to find out more.
Feb 6, 2010

Starting out with the Zend Framework


Every decision I seem to make always takes me a long time, I like to mull things over in my head perhaps too much. I have been thinking about frameworks for a while and I had delved into Symfony but not really got on with it and this had narrowed my decision down to cake or zend. I thought about this for a while and decided with zend because it is supported by a bigger community and it is also the framework of choice for Magento.



Ok so getting started with Zend was more problematic than I originally imagined, probably more so than Symfony, but I felt I have learnt a few things along the way that could be useful to anyone else who would like to get started with Zend. I use Windows and Xampp.

 

The first step is to download the Zend framework from here.

 

Unzip your files to a directory on your computer and make a note of the path.

 

in php.ini set include_path to the directory of Zend

 

Also in your php.ini make sure extension=php_domxml.dll is commented out or this will cause problems at run time.

 

This is a uber geeky windows config part, but it is essential to get the Zend command line working.

 

Right click my computer > properties > advanced system settings now click advanced tab and click on environment variables find the PATH variable and edit and add on where php.exe is i added c:/xampp2/php

 

This will allow you to access the files with in your PHP directory directly.

 

Goto your zend/bin folder copy zf.bat and zf.php to your php directory, you will need to access these from any directory too.

 

I am using xampp so I needed to goto the apache directory and uncomment the line that says #LoadModule rewrite_module modules/mod_rewrite.so, as the Zend Framework relies on SEF urls.

 

Now you need to follow the instructions on the zend site to setup a new project.

 

When I tried to run the public folder I revieved an error and I fixed it by copying the c:/zend/library/zend folder to your library folder and change public/index.php to point to library/zend/application.php but I realised changing tehe include path in the index file was not the way, the best way is to create a virtual directory.

 

To setup a vitual directory, you may need to right click notepad to run as administrator in vista and edit the following file: C:\windows\system32\drivers\etc\hosts:

Add the line:

127.0.0.1 dev.yourproject

Now in your: C:\path\to\your\httpd.conf:

Add this code

<VirtualHost *:80>
ServerName dev.yourproject
DocumentRoot C:\path\to\your\zfproject\public
<Directory C:\path\to\your\zfproject\public>
Order deny,allow
Deny from all
Allow from 127.0.0.1
AllowOverride All
</Directory>
</VirtualHost>

You should now be able to type http://dev.yourproject/ into your browser and see your web site.