sidebar
Zend Server 6.x or later
GNU / Linux
Zend Server includes most of the most popular PHP extensions. Of course, in some cases our users may need additional extensions for their applications. This article has two examples of PHP extensions compilation for Zend Server - the YAML extension and the SNMP extension.
There is also a more detailed explanation of the process in on-line documentation:
UNIX: Compiling PHP Extensions
Disclaimer:
Zend can provide only limited support for extensions compiled in such way.
The machine where the extensions are to be compiled, obviously, must have Zend Server installed. We will also need the PHP source packages for the corresponding PHP version (5.6 in all examples below) and the following common build tools: automake, autoconf, libtool, make and gcc.
RHEL / CentOS / OEL:
Ubuntu / Debian:
Note:
Make sure to change the PHP version accordingly in the above commands. For instance, if you're using Zend Server 9.1.x, you should install the package php-7.1-source-zend-server
The system is now ready.
First, we need to install the dependencies for this specific PHP extension - the 'libyaml' package and the corresponding development package:
RHEL / CentOS / OEL:
Ubuntu / Debian:
Note:
Obviously, each extension has its own set of dependencies and prerequisites - make sure that you carefully read the text of error and warning messages that may be displayed during configuration and compilation. In some cases you may need to perform additional internet research to satisfy such dependencies and prerequisites.
After the package installation is finished, we can compile the extension. First, we should verify that the extension can be obtained fromPECL:
Once confirmed, we can do the actual configuration and compilation:
The 'pecl' script will also place the compiled extension into the correct location:
The first step is the same - dependencies installation:
RHEL / CentOS / OEL:
Ubuntu / Debian:
Note:
Obviously, each extension has its own set of dependencies and prerequisites - make sure that you carefully read the text of error and warning messages that may be displayed during configuration and compilation. In some cases you may need to perform additional internet research to satisfy such dependencies and prerequisites.
The extension source code is installed in the 'share' directory of Zend Server's installation tree. We need to make this our working directory:
RHEL / CentOS / OEL:
Ubuntu / Debian (path is different for different PHP versions):
To create the configuration that will match Zend Server, we need to execute 'phpize' in the source code directory:
Then we use the generated configuration file with the 'configure' script (in the same source code directory):
Finally, we can build the extension and move the ready binary to the correct location:
To verify:
To be able to use the compiled extensions, we need to modify PHP configuration (load the extensions):
And to be able to manage these extensions from Zend Server UI, we need to make sure that the configuration files' ownership is correct:
All that's left is Zend Server restart:
After the restart you should be able to see the new extensions in 'phpinfo()' output and use these extensions' functions in your code.