Installing PHP extensions in the LAMP app
2 min read

Installing PHP extensions in the LAMP app

In my previous post, I outlined how the Cloudron can run custom LAMP apps. You simply install the LAMP  app and upload your app using SFTP. Everything around the LAMP app including DNS setup, Let's Encrypt certificate installation and renewal, backups and restores are completely taken care of by the Cloudron.

Today, we will see how to install custom PHP extensions in the LAMP app.

Pre-installed PHP extensions

The LAMP app already includes most of the popular PHP extensions including the following:

  • php-imap
  • php-mbstring
  • php-mcrypt
  • php-mysql
  • php-redis
  • php-xml
  • php-zip

You can check the complete list of pre-installed extensions by visiting the default index.php of the app that prints out phpInfo(). Alternately, you can view the source code of the LAMP app here.

Pre-installed extensions will be kept up-to-date automatically.

Installing custom extensions

As an example, we will install ionCube Loader, which is often required to install commercial PHP apps.

Step 1: Download ionCube

Download and extract the tar.gz or zip Linux 64-bit ionCube packages to your PC/Mac from the ionCube website or use the direct link.

Step 2: Upload using SFTP

Upload the extracted directory to the SFTP root directory (/app/data) of the Cloudron app (i.e one level above public/).

Step 3: Enable extension

In the top level directory of the Cloudron app (in /app/data), you will find a php.ini.

Add the following line to enable the extension (just add it before the many ;extension lines):

zend_extension=/app/data/ioncube/ioncube_loader_lin_7.0.so

The LAMP app has thread safety disabled, so we choose the extension without the ts extension.

Step 4: Restart app

Lastly, restart the app for the extension to be enabled. You can do this using the Restart button in the app's configure dialog (the pencil icon in the app grid).

Verifying installation

Visit the LAMP app's default page to verify that the extension is enabled.