Adding Extensions

In this Topic Hide

Compiling Extensions

This section includes information for the following Operating Systems:

Zend Server for IBM i users can benefit from extension management capabilities for third party extensions as well as for Zend Extensions. This enables users to load and unload all extensions directly from the Zend Server for IBM i Extensions page.

Important: The newly added extensions will be visible in the Administration Interface's Extensions page however, the directive configuration option will not be active and directives belonging to the extension have to be configured directly from the php.ini file.

Disclaimer:

Zend Technologies does not provide support for third party products, including extensions. Therefore, if an issue for support arises, please remove all third party extensions by commenting out the reference to them in your php.ini before referring to the Support Center - http://www.zend.com/en/support-center/.

There are two types of extensions: PHP extensions and Zend extensions. The extension provider should supply information regarding the extension type (Zend or PHP). Make sure to also check the provider's documentation for possible compatibility issues, PHP version compatibility and any other additional configurations that may be required.

 

 

ref_icon.png

To add Zend extensions:

  1. Download the extension
    Note: Zend Server for IBM i for IBM i - AIX Unix/Linux extensions end with the .so suffix.

  2. Place the extension in your extensions directory.
    To locate the extensions directory, open the Administration Interface to Monitor | PHP Info and check the value for the directive extension_dir=.
    By default, your extensions directory is located in:
    <install_path>/zend/lib/php_extensions

  3. Add the following line to your php.ini:
    zend_extension=<full_path_to_extension_so_file>

  4. Restart your server.

  5. To restart your server:

    Click Restart Server restart-btn-pe.gif in the Administration Interface.

    Ensure that the extension is properly loaded by checking the output of PHPInfo in the Administration Interface.

Note:

If you try to load a PHP extension as a Zend extension, in Linux you may receive the following error message in your server's error log: "<extension_name> doesn't appear to be a valid Zend extension."
If this occurs, remove it and add it as a PHP extension, following the instructions under "To Add PHP Extensions", below.

 

 

ref_icon.png

To add PHP extensions

  1. Download the third party extension. Many third party extensions can be found at http://pecl.php.net.
    Extensions are obtained directly from external web repositories.

  2. Place the PHP extension in your extensions directory.
    To locate the extensions directory, open your php.ini and check the value for the directive extension_dir=.
    By default, your extensions directory is located in:
    <install_path>/lib/php_extensions

  3. Add the following line to your php.ini:
    extension=<my_extension_name>.so

    Ensure that you replace <my_extension_name> with your extension's name.

  4. Restart your Web server.
    Ensure that the extension is properly loaded by checking the Administration Interface: See Monitor | PHP Info for the output of PHP Info.

The extensions appear in your Administration Interface under the Extensions tab and you can use the Administration Interface to load and unload the extension.

Compiling Extensions

Under Unix/Linux operating systems you can also create and compile your own extensions using the phpize command.

Disclaimer:

External extensions are not supported by Zend. If you encounter a problem, remove any additional extensions before contacting Zend Support.

Building PHP extensions from source requires basic UNIX skills as well as several build tools, among others:

 

 

ref_icon.png

To compile extensions from source:

  1. Download and extract the extension's source.

  2. Switch to the extension source directory (by default located in <install_path>/Zend/ZendServer/lib/phpext) and run the following commands:

cd <your_extension_directory>

<install_path>/bin/phpize

Ensure that you replace <your_extension_directory> with your extension directory's name.

  1. Run the ./configure command to prepare the source for compilation. You will need to include the "php-config" and "enable-shared" flags as follows:

./configure --with-php-config=<install_path>/bin/php-config\

            --enable-shared

Note:

Some extensions will need additional configuration flags. It is therefore advised to run "./configure --help" and review the possible flags before compiling.

  1. Compile and install the extension binaries by running the following commands:

make

make install

Make install should install the new .so extension binary in Zend Server for IBM i's extension directory.

  1. Add the following line to your php.ini to load your new extension:  

extension=<my_extension_name>.so

Replace <my_extension_name> with your extension's binary name.

  1. Restart your Web server.

  2. Ensure that the extension is properly loaded by checking the output of PHP Info. This can be viewed in the Zend Server for IBM i PHP Info page.

The extension appears in your Administration Interface under the Extensions page and you can use the Administration Interface to load and unload the extension.

 

 

Related Links

Related Links:

Installing Directories

Configuring Zend Server

Working with Extensions 

http://pecl4win.php.net/  - external link