In this how-to, we are going to setup Zend Framework in our domain. It’s recommended to have SSH access to a server running CentOS and Plesk.
So basically, what we are going to do is:
- Get a copy of the framework (the latest version or a specific version, whatever our needs are)
- Copy the frameworks files to a directory in our server
- Configure our domain or virtual host to use (and search) the framework files in the directory we want
Great, so let’s get started. First things first, lets get a copy of the latest version of the framework and place it in /usr/local/src (or any other path we want):
cd /usr/local/src wget http://framework.zend.com/releases/ZendFramework-1.10.2/ZendFramework-1.10.2-minimal.tar.gz
In this case, we are getting the “Minimal” package, if we want the “Full” package (which comes with additional libraries), we do:
wget http://framework.zend.com/releases/ZendFramework-1.10.2/ZendFramework-1.10.2.tar.gz
After, we “untar” the file executing:
tar -xvf http://framework.zend.com/releases/ZendFramework-1.10.2/ZendFramework-1.10.2-minimal.tar.gz
and we will get a folder named ZendFramework-1.10.2-minimal, we changed it to ZendFramework-1.10.2
mv ZendFramework-1.10.2-minimal ZendFramework-1.10.2
Awesome, our Zend Framework folder is all set.
Now we need to configure our domain or virtual host (or sub domain) to automatically look for the framework files in this directory (so we don’t have to copy all of the files to our application library folder). To do so, we go to our domain root folder (we will use a mydomain.com example in this case):
cd /var/www/vhosts/mydomain.com
then, we create a configuration file in the conf folder
vi conf/vhost.conf
inside this file, we write this:
<Directory /var/www/vhosts/mydoman.com/httpdocs> php_admin_value include_path ".:/usr/local/src/ZendFramework-1.10.2/library" php_admin_value open_basedir "/usr/local/src/ZendFramework-1.10.2/library:/var/www/vhosts/mydomain.com/httpdocs:/var/www/vhosts/mydomain.com/application:/var/www/vhosts/mydomain.com/data" </Directory>
(to save file, press the Esc key and type :wq to save the changes and exit the editor)
Cool, so now we need to ask Plesk to re-configure our domain configuration (Plesk will add a Include line in the domain virtual host configuration file), to do so, we type:
/usr/local/psa/admin/sbin/websrvmng -av
next, we ask Apache to re-read the configuration files:
apachectl graceful
for the paranoics out there, you can also reboot the whole server by executing:
/etc/init.d/httpd restart
And that’s it! Now we can just *use* our Zend Framework based app without having to copy the framework files in the library folder.
Happy coding!
Leave a Reply
We would love to hear your feedback. Please no link dropping, no keywords or domains as names; do not spam, and do not advertise!