How to Install Zend Framework?
Zend Framework is one of the famous PHP framework in the world. It’s an open source, object oriented web application framework for PHP 5. Zend Framework is often called a ‘component library’, because it has many loosely coupled components that you can use more or less independently. Many of our readers was asking about how to install Zend Framework. This article is written based on our experience of installing this nice and powerful framework. We will assume you already familiar with PHP environment, such as how to edit php.ini file, restart Apache/web server and so on.
We will talk about general steps to install Zend Framework and it’s applicable for both Windows and Linux/Unix platform.
Important Notes:
- At the time this article was written, version of Zend Framework is 1.10.2.
- We are using XAMPP for Windows in this scenario
1. Download Zend Framework from http://framework.zend.com/download/latest. There are several options in their download page, but please download the full one. In this case I choose http://framework.zend.com/releases/ZendFramework-1.10.2/ZendFramework-1.10.2.tar.gz.
2. Extract it and it will create this folder structure.
3. See on above structure. Actually, the Zend Framework code is inside the ‘library’ folder. That is the important folder and PHP must know where is that folder was located.
4. How to make PHP knows the Zend Framework ‘library’ folder location? It’s easy, we must edit php.ini file. The php.ini file contains many configuration options for PHP environment. You must configure the ‘include_path’ value on your php.ini file. But wait, where is the location of my active php.ini? On my XAMPP instalation the php.ini file location is inside the ‘php’ folder on the XAMPP installation directory. Precisely on mine is at ‘C:\xampp\php’.
But how about you that not sure about the location of your active php.ini file? Here is the way. Please create a php file like below.
1 | <?php phpinfo(); ?> |
Save it as pi.php on your web root folder and then run it from your web browser. The sample will be like below.
That’s screen shot is comes from my machine and it’s clear that my php.ini is located on ‘C:\xampp\php\php.ini’.
5. Edit the php.ini file and search for ‘include_path’ configuration and then add the Zend Framework ‘library’ folder to that value. The example like below.
Here is my previous php.ini ‘include_path’ configuration value.
include_path = ".;C:\xampp\php\PEAR"
Now I add the Zend Framework ‘library’ folder to that include_path configuration like below.
include_path = ".;C:\xampp\php\PEAR;C:\master\frameworks\ZendFramework-1.10.2\library"
You can adjust with your environment condition. The above sample is on my windows machine environment. The separator for the library folder is using the ; character. On my Linux environment, my ‘include_path’ value is like below.
include_path = ".:/usr/local/lib/php"
And now I add the Zend Framework ‘library’ folder to php.ini and now become like below.
include_path = ".:/usr/local/lib/php:/home/sonyak/master/frameworks/ZendFramework-1.10.2/library"
After you modify the php.ini now you must restart your Apache web server to reflect the changes.
6. Now your Zend Framework should be available on your library path. How to check if Zend Framework is already included on your library path? Just run again the pi.php from point (4) above. Search for ‘include_path’ string and your changes to the php.ini should be applied. Here is the example on my machine.
7. Last step we will try to use one of from many Zend Framework class. We will utilize the Zend_Feed_Rss to read the RSS feeds from Sony AK Knowledge Center website.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <?php // similar to require_once require_once 'Zend/Loader.php'; // now load the Zend_Feed_Rss class Zend_Loader::loadClass('Zend_Feed_Rss'); // get the rss feeds $channel = new Zend_Feed_Rss('http://www.sony-ak.com/feed/rss/'); // output the RSS channel title :) echo $channel->title(); // above will output 'Sony AK Knowledge Center' string. ?> |
OK, now everything is finished. You can use your Zend Framework on your system. If Zend Framework version is increasing, you just copy the new full ‘library’ folder of the new release to your previous Zend Framework installation.
Zend Framework on shared hosting (GoDaddy)
How about if you don’t have access to edit the php.ini file? For example on your GoDaddy.com shared hosting environment. No problem, for PHP 5 you can create php5.ini on your web root folder on GoDaddy.com hosting and then you create ‘include_path’ entry and save it.
Here is sample of my php5.ini on GoDaddy.com shared hosting environment.
[root@sonyakmachine html]$ cat php5.ini include_path = ".:/usr/local/php5/lib/php:/home/content/e/a/r/earthsto/html/library/ZendFramework-1.10.2/library"
The ‘.:/usr/local/php5/lib/php’ is the original php5.ini content and then I added ‘/home/content/e/a/r/earthsto/html/library/ZendFramework-1.10.2/library’ (location of my Zend Framework library) to php5.ini.
How to install Zend Framework without editing php.ini?
Now there are some other questions about how to install Zend Framework without touching the php.ini file. OK, there is another way to achive this, using ini_set() function on PHP. Here is the sample.
1 2 3 4 5 | <?php ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . "C:\master\frameworks\ZendFramework-1.10.1\library"); // your code here... ?> |
The ini_set() function is used to set value of include_path entry on the php.ini when your script is running. You can adjust the location of Zend Framework library folder to your environment condition.
Reference:
- http://framework.zend.com/manual/en/learning.quickstart.intro.html








hey this blog is great. I’m glad I came by this blog. Maybe I can contribute in the near future. PM ME on Yahoo AmandaLovesYou702 Thank you day141
amazing being surfing for a simple explanation and came to this excellent tutorial, do u guys have RSS in this blog if so please let me know thanks again
include_patth is not working, its not showing in phpinfo();
include_path = “.;g:\xampp\php\PEAR;g:\ZendFramework-1.10.2\library”
@mohammad are you sure? perhaps you edit the wrong php.ini
ini yg aku cari Mas Sony…makasih ya,,,
thanks mas tutorialnya..
manteb.. dari tadi nyari tutorial yang pas ga nemu2
akhirnya kesasar kesini
@ngajari thanks juga mas udah ke sony-ak.com sering2 mampir ke sini yah
Nah ini dia yang aku cari ^_^. susah cari developer php berkompeten. tapi yang satu ini sangat berkompeten and mau berbagi ilmunya
Bravo developer Indonesia