Zend framework is one of the most popular frameworks for developing modern PHP applications. The framework is modular, extensible and highly secure and that is why it is used by many developers. Today we are going to show you how to install Zend framework on a Linux VPS and create your first project.
For this tutorial we assume that you are using an Ubuntu VPS with Ubuntu 14.04 installed. Also, you need to have a LAMP stack installed on you server. Before we start with the installation of Zend framework, you need to log in to your VPS via SSH and update the system software to the latest version available. To update the system software, execute the following commands:
apt-get update apt-get upgrade
It could take few minutes for the update to be completed.
Easiest way to install Zend framework on Ubuntu 14.04 is to use the package which is provided by Ubuntu. Therefore, execute the following command in order to install Zend framework on your server:
apt-get install zend-framework
Next, navigate to your server’s directory root and create your first project:
cd /var/www/ zf create project YourFirstApplication
You can replace YourFirstApplication with the name of the application you like to create.
Then, navigate to the /var/www/YourFirstApplication/library/ directory and create a symbolic link to the library directory using the following commands:
cd /var/www/YourFirstApplication/library/ ln -s /usr/share/php/libzend-framework-php/Zend .
Or, you can add the library directory to the include_path in your php.ini file.
The last thing you need to do is to edit the virtual host file and change the document root. To edit your /etc/apache2/sites-enabled/000-default file you can use an editor of your choice. We are using nano.
You need to edit the following lines to match your needs:
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/YourFirstApplication/public/ ServerName yourdomain.com ServerAlias www.yourdomain.com <Directory /var/www/YourFirstApplication/public/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/httpd/yourdomain.com-error_log CustomLog /var/log/httpd/yourdomain.com-access_log common </VirtualHost>
Most important is to change the DocumentRoot to point to your application public directory as well as to replace yourdomain.com with your actual domain name.
Once you are done, save the file and close it. Restart Apache for the changes to take effect.
service apache2 restart
Now you should be able to access your first project using a web browser. Open your favorite web browser and enter yourdomain.com in the search field.
To learn more about Zend framework you can visit http://framework.zend.com/
There you can find information about how to get started and how to effectively use this powerful framework in order to create modern PHP applications.
Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install Zend framework for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.