How to install Zend Framework on Linux CentOS
-
29-09-2019 - |
Question
I have a VPS server and I need to install the Zend Framework for its Google client library.
I am confused as to whether I can install Zend for particular site or if I need to install as the root user so it will be available for all websites on that Linux server.
Solution
Nope, you don't need to install it. Zend Framework is just a bunch of php scripts in general. So download it, unpack it anywhere you want and include
(or require
, doesn't matter) necessary classes.
OTHER TIPS
for centos 6
install epel repository: rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
install ZendFramework: yum install php-ZendFramework
I recently had to install Zend Framework 1 on an old CentOS 5 server in order to support web applications built using Zend Framework. Since there’s no RPM available for RHEL 5, I had to manually install the package but I’ll include details for installing via RPM on CentOS 6.
Manual Installation
Note: I usually log in as a regular (non-super) user and use sudo
for
administrative tasks.
Download the zip archive into your home directory and unzip it:
tar xvzf ZendFramework-version.tar.gz
Create a directory for PHP applications in /usr/local/share
. According to
the Filesystem Hierarchy Standard (see man hier
), /usr/local/share
is
for:
Local application data that can be shared among different architectures of the same OS
sudo mkdir -p /usr/local/share/php
Note: the -p
option won’t produce an error if the directory already exists.
Copy the Zend Framework library into this directory:
sudo mv ~/ZendFramework-version/ /usr/local/share/php/Zend
Create a symbolic link for the zf
command:
sudo ln -s /usr/local/share/php/Zend/bin/zf.sh /usr/local/bin/zf
Finally, add the Zend library to PHP’s include_path
(and restart the web
server so it uses the new PHP configuration):
include_path = ".:/usr/local/share/php/Zend/library"
Install using RPM for RHEL 6
Packages for RHEL 6 /CentOS 6 are available in the Extra Packages for Enterprise Linux repository.
php-ZendFramework
: basic Zend Frameworkphp-ZendFramework2
: Zend Framework 2php-ZendFramework-full
: Meta package to install full Zend Framework; this installs a much larger set of packages (Zend Framework components and PHP modules).
The minimal install requires the php-bcmath
and php-process
packages.
- The library code is installed to
/usr/share/php/Zend
. - The
zf
command is installed to/usr/bin/zf
which is a symbolic link to/usr/share/php/Zend/zf.sh
.
If you don’t already have the EPEL repository installed, the CentOS Extras repository includes a package to install the EPEL repository (enabled by default).
sudo yum install epel-release
After adding the EPEL repository, I usually configure it to be disabled by default so if I’m installing a package, the standard repositories are used; if I want to install a package from an EPEL repository, I explicitly do so in my yum
commands. This is done by setting enabled=0
in /etc/yum.repos.d/epel.repo
.
Install preferred Zend Framework package:
sudo yum --enablerepo=epel install php-ZendFramework
sudo yum --enablerepo=epel install php-ZendFramework2
sudo yum --enablerepo=epel install php-ZendFramework-full