Quick Tip: 4 Steps to Install Custom PHP Extensions into Zend Server 7

Share this article

Zend Server 7 is an excellent tool for managing, deploying and monitoring your PHP applications. We’ve covered its installation in this quick tip, and we’ve given it a somewhat thorough review in this post.

In this Quick Tip, we’ll go through the procedure of installing custom PHP extensions into it. We’ll be installing Phalcon, but the procedure is identical for nearly all extensions out there.

Step 1: Install Zend Server

Have an instance of ZS up and running. Follow this quick tip to do that.

Step 2: Modify the $PATH

To use the command line PHP tools that come bundled with Zend Server, we need to add the path to them to the system $PATH variable:

echo "PATH=\"/usr/local/zend/bin:\$PATH"\" >> ~/.profile
source ~/.profile 
php --version

If the last command executes successfully, you’ve succeeded.

This isn’t enough, though. Phalcon’s installation script needs to be executed with administrator rights, and sudo users don’t use the same PATH variable as the regular ones. We’ll deal with that later.

Step 3: Download and Build Phalcon

We’ll start off by installing some missing tools: git and autoconf.

sudo apt-get install git autoconf
cd ~/Code
git clone --depth=1 git://github.com/phalcon/cphalcon.git
cd cphalcon/build

Since the PHP development tools (phpize, for example) bundled with ZS are in a different bin folder, the root user doesn’t know how to get them (root users use different $PATH variables than regular ones). Running sudo ./install as per Phalcon’s installation instructions would therefore not work. We can, however, simulate a login by running sudo -i, which keeps the current user’s $PATH.

sudo -i
cd /home/vagrant/Code/cphalcon/build

Step 4: Activate Phalcon

After the installation completes, feel free to exit sudo mode with exit. Then, let’s make a phalcon.ini file in /usr/local/zend/etc/conf.d/.

sudo vim /usr/local/zend/etc/conf.d/phalcon.ini

Give it the content:


Then, reload the Zend Server through the GUI. Go into Configurations -> PHP and scroll to the bottom of the extensions list. Phalcon will be there, loaded. If you check out PhpInfo under Overview -> Server Info, you’ll notice Phalcon has been installed and is active.

That’s all there is to it! You can now use Phalcon in all of your Zend Server powered apps!

Frequently Asked Questions (FAQs) on Installing Custom PHP Extensions on Zend Server 7

What are the prerequisites for installing custom PHP extensions on Zend Server 7?

Before you begin the installation process, you need to have Zend Server 7 installed on your system. You also need to have the PHP extension source code available. It’s also recommended to have a basic understanding of PHP and server management.

How can I verify if the PHP extension has been successfully installed?

After the installation process, you can verify the successful installation of the PHP extension by using the phpinfo() function. This function provides a lot of information about your PHP installation and it will list all the installed extensions. If your extension is listed, then it has been successfully installed.

What should I do if the installation of the PHP extension fails?

If the installation fails, the first step is to check the error message. The error message will usually give you a clue about what went wrong. Common issues include missing dependencies, incorrect file permissions, or problems with the extension code itself. If you can’t resolve the issue yourself, consider seeking help from the Zend community or a knowledgeable colleague.

Can I install multiple PHP extensions at the same time?

Yes, you can install multiple PHP extensions at the same time. However, it’s recommended to install them one at a time. This way, if something goes wrong, it’s easier to identify the problem.

How can I uninstall a PHP extension?

Uninstalling a PHP extension involves reversing the installation process. This usually means deleting the extension’s files from your server and removing any references to the extension from your PHP configuration file.

Are there any risks associated with installing custom PHP extensions?

Installing custom PHP extensions can pose some risks. For example, the extension could contain bugs or security vulnerabilities. It’s important to only install extensions from trusted sources and to keep them up-to-date.

Can I install PHP extensions without restarting the server?

Most of the time, you will need to restart your server after installing a new PHP extension. This is because the server needs to reload its configuration to include the new extension.

What is the difference between Zend extensions and PHP extensions?

Zend extensions and PHP extensions are both ways to add functionality to your PHP installation. However, they work at different levels. PHP extensions add new functions and classes to PHP, while Zend extensions operate at a lower level, modifying the behavior of the PHP engine itself.

Can I write my own PHP extensions?

Yes, you can write your own PHP extensions. However, this requires a good understanding of both PHP and C, as PHP extensions are typically written in C.

How can I update an installed PHP extension?

Updating an installed PHP extension usually involves downloading the latest version of the extension, uninstalling the old version, and then installing the new version. However, the exact process can vary depending on the extension.

Bruno SkvorcBruno Skvorc
View Author

Bruno is a blockchain developer and technical educator at the Web3 Foundation, the foundation that's building the next generation of the free people's internet. He runs two newsletters you should subscribe to if you're interested in Web3.0: Dot Leap covers ecosystem and tech development of Web3, and NFT Review covers the evolution of the non-fungible token (digital collectibles) ecosystem inside this emerging new web. His current passion project is RMRK.app, the most advanced NFT system in the world, which allows NFTs to own other NFTs, NFTs to react to emotion, NFTs to be governed democratically, and NFTs to be multiple things at once.

extensionsframeworknginxOOPHPphalconPHPquick-tipUbuntuvagrantVMZendzend frameworkzend server
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form