I’ve started playing with the Zend Framework and noticed that there were lots of getting started tutorials for the old versions. Since many of them don’t update or work anymore I’ve decided to write my own getting started version which should get you up to speed with Zend Framework version 1.0.1 in no time.
At first you need to download and install the framework in a seperate directory, you can either choose that it’s available in the include_path using the php.ini file or by setting it up in a folder which will be used only for your application. If you go for the first one edit the php.ini and search for the include_path directive, add the complete path to the library directory from the extracted Zend Framework archive and you should be set, don’t forget to reload Apache!
The second method is slightly harder but it should also be possible when you’re on a shared hosting platform and the provider hasn’t got the framework installed. Extract the archive somewhere outside the web root (this means that it shouldn’t be accessible through the website).
When you set up a new project, the following directory structure is recommended:
- app
- controllers
- views
- scripts
- library (contains the Zend Framework files)
- public_html (or htdocs in other cases - this is the web root)
In the public_html directory create a file called index.php. This will be our bootstrap for the framework. But first we need to get the PHP error reporting to a decent level and make sure to have access to the framework files. Open index.php and add the following; (continue reading…)