Category:
I am working on Zend Framework for the past One year or so. So, after a long time I desiced to post a topic in my Blog as how to install Zend Framework to Ubuntu 11.04.
I khow it will be helpfull to some one, who is trying to use Zend Framework in Linux boxes. So, to do this I will be using these following,
- Ubuntu 11.04 Desktop Linux with PHP 5.3 and MySQL pre installed. This tutorial assumes that you have installed them as well.
- Zend Framework latest Library as 1.11.09. You can download it from Here. Download the ZendFramework 1.11.XX Full package from there.
Now, Lets proceed with the installation. I will explain in a step by step format.
-
I hope that you have downloaded the package in the tar.gz format. So it is time to extract it. I am extracting it in /usr/share/. So, in your terminal run this command,
aneek@aneek:~$ sudo cp Desktop/ZendFramework-1.11.9.tar.gz /usr/local/ [sudo] password for aneek:
-
Then extract it with the following command,
aneek@aneek:~/Desktop$ cd /usr/local/ aneek@aneek:/usr/local$ sudo tar -xzvf ZendFramework-1.11.9.tar.gz
-
Then rename the directory to ZendFramework.
aneek@aneek:/usr/local$ sudo mv ZendFramework-1.11.9 ZendFramework
-
So we will get this kind of structure,

-
Now provide the suitable permission to the directory. So again type in the following commands to Shell,
aneek@aneek:/usr/local$ sudo chmod 0755 ZendFramework aneek@aneek:/usr/local$ sudo chmod -R 0755 ZendFramework/*
- So far what we have done is just copyed and pasted the library. Now it's time to enable the library to the php.ini and also to enable the zend framework tool or the zf tool.
-
First I will enable the zf tool. To do this we have to create a symlink to the tool. For windows we have a batch file and for linux Zend provides a shell script. So it will just be creating a symlink after all, nothing more. To do this, copy the command to your shell,
aneek@aneek:/usr/local$ ln -s /usr/local/ZendFramework/bin/zf.sh /usr/bin/zf
This will create a symlink to /usr/bin/. Now we can test the tool.
-
To test the tool, go to the terminal and type the following command,
aneek@aneek:/usr$ zf show version
This will show the Zend Framework Version as the image below,

-
Next we will enable the Library path to the php.ini. So to do that we will open the file in a text editor. So for that we will again go to the terminal and type the following,
As we are using Ubuntu so php.ini will be in "/etc/php5/apache2/". Next,aneek@aneek:/usr$ sudo gedit /etc/php5/apache2/php.ini
This will open up gedit and php.ini. There search for include_path. You will see an area that says,
;UNIX: ";/path1:/path2"; ;include_path = ".:/usr/share/php";
Uncomment the include_path line and add your Zend Framework library path. Make it as,
include_path = ".:/usr/share/php:/usr/local/ZendFramework/library"
Save the file and exit.
-
Now restart apache to see the effect. So again fireup the terminal and type,
aneek@aneek:/usr$ sudo /etc/init.d/apache2 restart [sudo] password for aneek:
This command will restart apache. So finally we will test Zend Framework.
-
To test the framework we have to create a project. So, navigate to your php root directory and then issue the command,
aneek@aneek:~/www/framework$ zf create project zf_test Creating project at /var/www/framework/zf_test Note: This command created a web project, for more information setting up your VHOST, please see docs/README
This command will create the project for you. So to test open up your browser and navigate the path through localhost. You will see as the following image.

If you have any problemtill now you can post a comment. So that I can review it and provide some answers. If you get any errors like path not found to any Zend Library files then that means your library path is incorrect in the php.ini. As you can see that, we are not using virtualhost till now. So we will use it now. -
Before we proceed with the virtual host, I would like to make one small change in the .htaccess file in the created project. I will change the application environment to trace errors. So open up your .htaccess file placed in the public directory in the project directory root and change it like mine.
SetEnv APPLICATION_ENV development RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] -
Now we will change the virtual host settings,
Go to /etc/apache2/sites-available/. Create a file named after the domain(zf_test.local).<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName zf_test.local DocumentRoot /var/www/framework/zf_test/public # this entry is necessary to allow the virtual host to enable mod rewrite using htaccess <Directory /var/www/framework/zf_test/public> Options Indexes FollowSymLinks AllowOverride All allow from all </Directory> </VirtualHost>Then to enable it issue,
a2ensite zf_test.local
This will enable your virtualhost settings and you will see that an entry is created in /etc/apache2/sites-enabled/ directory.
- At last create an entry to the host file with the domain name as zf_test.local to 127.0.0.1. Restart apache and you are ready to go. So fire up your browser and type in http://zf_test.local. This will open that page again. So you have a working virtual host.
So that is all about how to install Zend Framework in ubuntu. Specially in Ubuntu 11.04. But I guess it will be the same for the lower versions as well. If this topic is helpfull to you then please stop here and provide a comment about how it worked in your system. Also do share your views on this topic and if you face any errors.
Comments
How to install Zend Framework in Ubuntu
Submitted by Bade Lal Verma (not verified) on
Hi,
I read your tutorial, and i follow all the steps to set up zend framework on ubuntu 11.10
Every thing was going good, but at last when i create a project through this
dipak@dipak-VPBEB12FN:/var/www$ zf create project my_zend_project
command in /var/www directory, i get the following message
dipak@dipak-VPCEB12EN:/var/www$ zf create project my_zend_project
Creating project at /var/www/my_zend_project
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
then how to correct the following error
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
Please reply me....
Thanks in Advance
Testing Note: PHPUnit Fix
Submitted by aneek on
Hello,
It is just a notice from your ZF shell file that PHPUnit the popular testing framework is not installed.
You can ignore this one if you are not into hardcore Zend Framework Development or just want to omit the Unit testing. But, I think you have a great interest to know this. So please follow the steps to install PHPUnit to your Ubuntu.
Go to your terminal and then paste the following.
All done then, restart your apache.
Then again,
Then if you create project you won't see the error coming. If you still see it please let me know.
Problem
Submitted by Samanta (not verified) on
Hi I have a problem when I try this:
phpunit --version
this error appears
PHP Fatal error: Call to undefined method PHP_CodeCoverage_Filter::getInstance() in /usr/bin/phpunit on line 39
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
I hope you can help me.
(Sorry for my poor english)
Samanta
Hai , i follow your steps and
Submitted by krishnaraj (not verified) on
Hai , i follow your steps and created a new project, but while running that project it showing error
Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /var/www/framworks/zf_test/public/index.php on line 18 Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/var/www/framworks/zf_test/library:.:/usr/share/php:/usr/share/pear') in /var/www/framworks/zf_test/public/index.php on line 18
please reply
Solving require_once(Zend/Application.php)
Submitted by aneek on
Hello,
I think you have missed some steps. I guess, you have to include the Zend Framework's Library path to php.ini file.
Please follow the tutorial again and then include the library path to your server's php.ini. I hope this will solve your problem.
But if you face the problem again please let me know.
Somth wrong
Submitted by Vadim (not verified) on
Hi. I was installing zend on ubuntu and then placed there existing project. The project was working fine on another hosting but doesnt here. So I followed your steps and reinstalled everething. Then I created a project and I 've got just blanc page. That's very strange. I suggest i missed some settings some where. Have you got any suggestions?
When I test index.php in public it's working until meets :
required_once('Zend/Application.php');
And then stops. I did the same on amazon ec2 and exactly same result -> blanc page.
If you 've got some clue I'll be happy to listen.
Thanks a lot.
It may have many causes of errors
Submitted by aneek on
Hello Vadim,
As per your post, I think it may have many cause of errors. As example,
Check your permissions to the directory and .htaccess file.
All of the production servers have the error reporting as Zero, means do not show any errors. So You can enable the error reporting, then try running the index file. I think the blank page will show something.
Again, if you see a fetal error as required_once('Zend/Application.php'); not found then you have to properly set up the library path to the server's php.ini.
Please let me know if the problem still exists after doing all of the things. I will try to help you.
Hi. Problem solved, If
Submitted by Vadim (not verified) on
Hi. Problem solved, If somebody will have somth simular. The issue was cause apache wasnt set up properly. We needed to configure some settings in apache.conf and in some other files. Now it's working fine. Thanks.
require_once()
Submitted by Shashi (not verified) on
I am getting the same error..How exactly did u resolve it?
Hi Vadim,
Submitted by rajat (not verified) on
Hi Vadim,
Could you pls let me know what changes you have been made to apache.conf and other files. I am facing the similar problems.
Thx
@aneek, in the beginning of
Submitted by Wel (not verified) on
@aneek, in the beginning of the tutorial, you declared to extract Zend to /usr/share, but in your actual example, you used /usr/local, could you tell which one should I follow strictly? Thanks
Location can be anywhere
Submitted by aneek on
Dear Wel,
You can use any locations. It depends upon you.
/usr/local
and
/usr/share is good. If you want to use /home/username/directory you can do that also.
Problem
Submitted by Ahmed (not verified) on
These was my errors
Warning: require_once(/opt/lampp/htdocs/xampp/test/application/forms/Login.php) [function.require-once]: failed to open stream: Aucun fichier ou dossier de ce type in /opt/lampp/htdocs/xampp/test/application/Forms/Login.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '/opt/lampp/htdocs/xampp/test/application/forms/Login.php' (include_path='/opt/lampp/htdocs/xampp/test/application/../library:/opt/lampp/htdocs/xampp/test/library:.:/usr/share/php/libzend-framework-php') in /opt/lampp/htdocs/xampp/test/application/Forms/Login.php on line 2
These errors are from your code
Submitted by aneek on
Dear Ahmed,
I guess these errors are occuring from your code that you have written. I was not able to understand the first line of the error but the second error seems to be comming from your codes. Probably, you have something wrong in the form that you have wtirren or if you see the Fetal error for the includes path then there is some thing sure wrong in Bootstrap.php or the configuration ini file.
Please check those. I hope this small bit of information can help you.
Hai,
Submitted by krishna (not verified) on
Hai,
I did all installation process as u say, but while creating a new project it shows following error
root@dckap-desktop:/var/www/framework# zf create project test2
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/idn.so' - /usr/lib/php5/20090626+lfs/idn.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
Creating project at /var/www/framework/test2
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.
Errors
Submitted by aneek on
Hello krishna,
For your reference, the first error is due to the PHP 5 has deprecated the '#' in the conf files in case of command line files. So change the '#' to ';' in desired places.
For the other 2 errors, you have something miss configured in your php.ini file. The include files either doesn't exist or the path is wrong. Please double check them. There is nothing to do with the Zend Installation.
Please let me know if this little information helped you out. Let me know if the problem still exists.
Problem in zf show version
Submitted by Srijan (not verified) on
When i run zf show version i get following output
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/gd.so' - /usr/lib/php5/20090626+lfs/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mcrypt.so' - /usr/lib/php5/20090626+lfs/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/tidy.so' - /usr/lib/php5/20090626+lfs/tidy.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/xmlrpc.so' - /usr/lib/php5/20090626+lfs/xmlrpc.so: cannot open shared object file: No such file or directory in Unknown on line 0
Zend Framework Version: 1.11.11
It saves several hours for me
Submitted by Pritam Sarkar (not verified) on
It saves several hours for me..
I'll buy you a beer buddy ;)
error on .htacess
Submitted by alejandro (not verified) on
Hi, first of all thanks a lot for such a nice tutorial. I have followed all steps, however iḿ facing a problem with .htacess file.
/var/log/apache2/error.log is showing:
[Wed Apr 11 09:25:42 2012] [alert] [client 127.0.0.1] /var/www/framework/zf_test/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
The .htaccess file is the one created by default with zf.sh tool.
Any suggestions will be really appreciated.
Thanks a lot in advance
error on .htacess
Submitted by alejandro (not verified) on
Hi, i have found the solution to my problem: http://www.joeldare.com/wiki/linux:using_.htaccess_on_ubuntu
Once again thanks a lot for this nice tutorial.
kind regards
Installing zend tool on lampp server
Submitted by Mujtaba (not verified) on
Any idea how to make the tool working under lampp server because different php and apache is used under lampp so I am not sure if making changes to the in /etc/php5/cli/php.ini will work for me?
Error installing Zend framework on Centos
Submitted by sachin sharma (not verified) on
[root@TechOpsStore php]# zf show version
PHP Fatal error: Cannot access self:: when no class scope is active in /usr/local/php/lib/php/ZendFramework/library/Zend/Tool/Framework/Provider/Signature.php on line 358
Fatal error: Cannot access self:: when no class scope is active in /usr/local/php/lib/php/ZendFramework/library/Zend/Tool/Framework/Provider/Signature.php on line 358
[root@TechOpsStore php]# /usr/bin/zf show version
PHP Fatal error: Cannot access self:: when no class scope is active in /usr/local/php/lib/php/ZendFramework/library/Zend/Tool/Framework/Provider/Signature.php on line 358
Fatal error: Cannot access self:: when no class scope is active in /usr/local/php/lib/php/ZendFramework/library/Zend/Tool/Framework/Provider/Signature.php on line 358
can you please help me out for this issue.I did same as your article.
also getting "cannot access self" error
Submitted by Robert McNicholas (not verified) on
Hi, I just tried installing Zend 1.11.11 on a CentOS 5 server, and I'm getting the same exact error (line 353 in Signature.php). Was this ever resolved? Thanks for any info!
Thanks a ton.
Submitted by Rohan Kamble (not verified) on
Thanks dude....this tutorial is a real time saver and completely understandable.
Thank you so much.
zend framework permission denied problem
Submitted by vinay (not verified) on
During the installation process when i tried to run command ln -s /usr/local/ZendFramework/bin/zf.sh /usr/bin/zf
This shows permission denied. However, i change the zend framework permission according to your tutorial. I am trying it in zendframework-1.11.11.tar.gz and don't know why this problem occurred.
please tell me the solution. and also intimate through email.
Thanks.
Go as Root
Submitted by aneek on
Dear vinay,
Try doing this with the Root access.
So you do,
I hope this can help you.
I face the same problem and
Submitted by Dhileep (not verified) on
I face the same problem and try thie above command also but it will create a project in my home directory.
After This a2ensite zf_test.local not getting
Submitted by rani (not verified) on
After enabling virtual host setting . am trying to run http://zf_test.local on my browser . Not able to open it ..
But am able to open http://localhost/framework/zf_test/public/index.php . Here am getting the output .
Can you please tell me what to do after enabling virtual host .
Thanks.
Rani
Check all permissions and if Mod rewrite
Submitted by aneek on
Dear Rani,
At this point I can't tell you why its happening. Check all permissions and then check is re-write module is on or not. Then do the a2ensite again. Check if the file is placed under /sites/sites-enabled. If yes then restart apache server by service apache2 reload and service apache2 restart.
I hope this can help you out. Please let me know if the problem still exists.
Not help
Submitted by dunmcl (not verified) on
re-write module is on but when I go to http://zf_test.local/ in my browser page dont load. If you have a few minutes, I can get TeamViewer access to my computer. Please email me if you have time to help me
How to install Zend Framework on RHEL 6
Submitted by sandeep (not verified) on
Hi,
I want to know the exact steps of installing Zend Framework on RHEL 6. Please help me onut asap.Hoping for ur quick help.
After This a2ensite zf_test.local not getting not working
Submitted by dunmcl (not verified) on
After This a2ensite zf_test.local not getting for me too. Nothing help
After This a2ensite zf_test.local not getting not working
Submitted by dunmcl (not verified) on
Only when I'm trying from ubuntu machine where installed apache. from another machine all work good
Add new comment