Adding Extensions

In this Topic Hide

Adding Extensions for Windows

Compiling Extensions

This section includes information for the following Operating Systems:

Zend Server 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 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: - 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.

Adding Extensions for Windows

The following procedure describes how to download compiled extensions for Wndows DLL files.

Windows Note:

When downloading extensions for Windows from PECL, make sure to download the non thread-safe (NTS) version ONLY.

 

 

Instructions on how to complete a procedure

To download extensions:

  1. Go to: http://www.php.net/downloads.php.

  2. In the Windows binaries section, select: "PECL <current ZendServer PHP version> Non-thread-safe Win32 binaries"  (64-bit users can use this too).

  3. Click  the package to start a download process. Follow the download instructions and extract the ZIP file.

  4. Select the .dll you want.

  5. To add the extension, go to the extension directory, <install_path>\ZendServer\lib\phpext, and add the .dll file there.

  6. Go to your php.ini file and add the following line: extension=<extension_name>.dll.

  7. To verify that the extension was loaded properly, go to Setup | Extensions and locate the extension from the list.
    When loading new extensions, also examine the log files.

For more information on these extensions, go to http://pecl4win.php.net/ .

Note: The extensions in this site are thread-safe and therefore should not be downloaded for use with Zend Server .

Note:

Some extensions need directives to change the Extension's default configurations. These directives should be added added to your php.ini file manually. There is no way to predict which directives extensions may have: For each third party extension you want to add, make sure to go to the project's source site to check for additional information related to 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'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 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