Installing ZendPHP on DEB (Debian and Ubuntu)

This topic describes the procedures for installing ZendPHP on an Ubuntu or Debian.

Set up repository on Debian/Ubuntu

Before installing ZendPHP for the first time, set up your repository:

  1. Add the GPG key to your apt keychain:

    curl -s | sudo apt-key add -

  2. Add the repository to your apt sources lists:

    $ sudo echo \ "deb{VERSION}/ zendphp non-free" \ > /etc/apt/sources.list.d/zendphp.list

    If you were provided credentials, provide the package manager with them:

    $ sudo \ echo "machine login {LOGIN_OR_ORDER_ID} password {PASSWORD}" \ > /etc/apt/auth.conf.d/zendphp.conf

  3. Update your package sources:

    sudo apt-get update

Install ZendPHP on Debian/Ubuntu

After setting up your repository and updating the packages, you can now install ZendPHP.

  1. Install the PHP packages:

    sudo apt-get install php{VERSION}-zend

    This installs the common modules and the CLI binary for the specified version. If you would like to explore the additional packages that are available, use sudo apt-cache search php{VERSION}-zend to search our package library.

    We recommend installing the following packages in addition to the base package:

  2. Switching PHP versions. You can switch between different PHP CLI binaries using the update-alternatives command:

    sudo update-alternatives --set php /usr/bin/php{VERSION}-zend

  3. [Optional] On Apache2, install the PHP package (representing mod_php) for your ZendPHP version:

    sudo apt-get install libapache2-mod-php{VERSION}-zend

    This enables mod_php and configures it for use in handling PHP files.

  4. [Optional] To install FastCGI on Apache2, you need to install the php-fpm package for your PHP version:

    sudo apt-get install php{VERSION}-zend-fpm

    Enable the FastCGI module and then configure the php-fpm bindings for it:

    sudo a2enmod proxy_fcgi setenvif sudo a2enconf php{VERSION}-zend-fpm

    Start the php-fpm pool and Apache2:

    sudo systemctl start php{VERSION}-zend-fpm sudo systemctl restart apache2

    Configuration for the pool is in /etc/php/{VERSION}-zend/fpm/php-fpm.conf.

  5. [Optional] To install FastCGI on nginx, you need to install the php-fpm package for your PHP version and nginx:

    sudo apt-get install php{VERSION}-zend-fpm nginx

    From here, you need to create a virtual host configuration for nginx that proxies PHP requests to FastCGI as handled by your PHP version. For example on PHP 7.4 you need to edit the /etc/nginx/sites-available/default file to read:

    server { listen 80; root /var/www/html; server_name _; index index.html index.html index.php; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/; } }

    Now start the php-fpm pool and restart nginx:

    sudo systemctl start php{VERSION}-zend-fpm sudo systemctl restart nginx

Installing and using PECL on Debian/Ubuntu

The PECL binary, used to compile and install extensions shipped via, is available via the php{VERSION}-zend-dev package and requires the php{VERSION}-zend-xml extension. You can install everything at once as follows:

sudo apt install -y php{VERSION}-zend-dev php{VERSION}-zend-xml

Installing an extension

Installing an extension via the PECL binary follows the generic instructions for all platforms:

sudo pecl install {extension_name}

Enabling an extension

Once compiled, you need to enable the extension. Generally, PECL provides information like the following on successful completion:

install ok: channel:// configuration option "php_ini" is not set to php.ini location You should add "" to php.ini

The important piece is the section contained in quotes in the last line. Copy that information and create a file named extensionname.ini in /etc/php/{VERSION}-zend/mods-available/ as follows:

sudo echo "; configuration for php common module ; priority=20" > /etc/php/{VERSION}-zend/mods-available/extension-name.ini

Once done run php -m (if using the CLI SAPI), or use phpinfo(), to verify that your extension is enabled.