Ion cube Loader

Running Encoded PHP Scripts with ionCube Loader

Encoding application sources is a common practice when it comes to protecting and/or licensing your application source code. Today we’ll talk about ionCube – one of the most popular and widely used solutions to prevent unauthorized use. Being PHP-oriented, ionCube provides two correlated tools  Encoder to compile PHP files into bytecode and Loader, which handles the execution of such encoded files.

Whilst encoding shouldn’t be a big problem for the majority of developers, running such protected application can become a real point of concern for an average user, since often it requires the involvement of some auxiliary modules and libraries. Thus, to enable executing secured PHP source code without struggling on manual server configurations, the Apiqcloud Cloud provides dedicated lightweight ionCube Loader add-on for one-click installation.

So, log in to the Apiqcloud dashboard with your credentials and follow the instruction on how to start operating encoded scripts in a matter of minutes.

ionCube Loader Add-On Installation

1. First of all, let’s ensure you have a proper PHP environment for processing your protected code with ionCube Loader.

For that, launch the environment topology wizard (by clicking either New Environment button at the dashboard top or Change environment topology icon next to the existing one) and switch to the PHP tab.                 

Here, application server choice depends only on your preferences (since both Apache and NGINX are supported), whilst a little more attention should be paid to the PHP versions list.

When selecting a particular engine, you need to consider it’s compatibility with the ionCube Encoder version your scripts were initially converted with. As a general rule of thumb, encoded files could be processed on PHP versions that are equal to and higher than the source Encoder language, i.e. the full backward compatibility is provided. However, there are a few exceptions here:

  • currently, PHP 7.1 is not supported
  • with PHP 7.0 engine, only PHP 5.6-based files can be decoded
  • with PHP 5.6 and PHP 5.5, scripts of PHP 4 version can’t be decoded

To confirm the set parameters, click on Create or Apply (depending on whether you’ve created a new environment or adjusted the existing one).

2. Now, enter Apiqcloud Marketplace and switch to the section with pluggable Add-ons.

Use the search box to locate the one-click ionCube package and click Install.

Tip: The ionCube add-on sources are available within Apiqcloud JPS Collection, alongside with a number of other useful prepackaged solutions (all of them can be integrated through importing a manifest.jps link for the appropriate repository).

  3. In the opened installation window, specify the following details:

  • Environment name – environment the ionCube tool should be integrated to (encoded-app, in our case)
  • Nodes – target PHP application server for the add-on appliance (is fetched automatically upon selecting the environment)

install ioncube loader web server

Proceed with clicking on Install and wait a minute till this process is completed (you’ll also receive the appropriate email notification).

Note: During add-on appliance, the appropriate application server will be restarted that can cause a temporary downtime of your service (if any is already running inside). To avoid such outage, scale-out a number of application servers beforehand so they can be restarted sequentially (with a predefined delay, 30 seconds by default).

Now, let’s check that the add-on is up and running properly.

Verification with ionCube Loader Wizard

The simplest way to ensure ionCube was successfully integrated is to review the php_info() server output – information on its status and version is listed in a separate block just under the main server configuration stats.

For a more comprehensive check-up, you can launch a dedicated ionCube Loader Wizard within the appropriate container. It will test the proper Loader operability and provide you with a guidance in case any issue is detected. This step is optional and does not affect the actual ionCube operability. Thus, if you consider the additional check is needed, follow the instructions below:

1. Upload this archive via the Deployment Manager and initiate its deployment by selecting the destination environment (e.g. encoded-app). ioncube encoded php file

2. In the opened dialog, type some custom context to run the wizard at (so that it won’t intersect your main app location – e.g. ioncube) and click Deploy.ioncube loader php

Tip: Consider enabling Zero DownTime (ZDT) functionality to ensure the availability of your project during subsequent redeployments. 


ioncube encoder
3. When the project is deployed, click open in browser next to it.

4. To launch the Wizard itself, append loader-wizard.php to the end of the opened tab URL. decode php ioncube

It will analyze and output the current ionCube add-on status, including the appropriate Loader version and PHP engine it runs at.  

5. For security reasons, it’s highly recommended to Delete the Wizard when it is no longer required – simply remove the server context it was handled at.php encryption ioncube

That’s it! Finally, let’s consider how to put the Loader add-on into action with the files that require decoding.


Running Encoded Application with ionCube

As a base for our encoded app example, we’ll use the default Apiqcloud Hello World project – take a quick look at a code snippet from its index.php file during conversion:

  • before encoding
<?php echo date(“Y”) ?>
  • after encoding
HR+cPzETxKVkUDPezoPuP9U3Q/AbpvijoNvPblnq/z4n22/wdzHK5YALipdjelyb3PzXDgW7R23a
sV4ho1xgjKfOhcILhKjjQzddzHCP4LgY6AVRniFjtYoeEVQG2us1pRfGtlLstVaL6mWkQBjh8xAo
KsSEOfF+M9IaQTh8/Slt5futFfMu7gy+KfX/AzDHP3YLGzXZJWrxI0MioqVEyqU+bMQ58ywvtRtT
U9tEkOE9ykLIcqk2hej71lJBS+JPbPJ/JyrJ7jyKaM0BD4k1PQ6BQP4rvlOnSFlSplNe82H4XB+e
u4uXE/zsICn8z3SzbFSIuy99rgbo0KozlbsrWlXNzCoeI7LIH7dvgdvQQJKIlfMUeh6K++qm7LYI
s6jhLiBDCH0+wQHk7TMf9onrc4lwFQdesycz3O4cdp3gALFMSSR304Yr5LUmnTyTyN2CW6dgVs9L
d6bbk7YnEUjQfc4BYBYHZH4E+FwWFqB5FI4+oyIb/aHl79iFyH37c3yH7HRdT6NCIqxttaQpRLXm
4AKttNrXZ7c3Gbk4f9onnyNVw/IO66+NQnNiwnrkTbZhUNPuvrmFKctqYsWjL0t707IiI17jJdpq
HjUTux5o3Gm/HIl+QbMJsvoaKbjXVmrF41bFePRxUwXRLjC3jTtrHcbXuFnQCvih36nAy+Zgj1aR
Ft/JBrVZcxOZHcQTTD3L5Y1rEcXPMj9bH6b6eu2UPwXfuadwtOVvbz0Xfd5ur69Z/CM4AqdRxkaQ
helGAdG5iYkkPeq=

The compiled code contains several layers of encoding that can be interpreted and processed only by ionCube Loader. This will be done automatically by the extension we’ve installed – just deploy your PHP project to the destination environment as usual and Open it in browser.ioncube encrypted code


The application is up and running, so it means the Loader has successfully processed all protected files
ioncube loader

At this point, with the required application structure being already deployed inside a container, your ionCube Loader performance can be additionally increased through eliminating from the unrequired files’ processing.


Restricting ionCube Work Area

With default settings, the Loader will examine all the files on a web server for being encoded and process the necessary ones when the appropriate application is launched. In order to accelerate this process and boost decoding performance, it’s a good practice to point Loader to the server location with your encoded files (or directly to the required ones).

Since ionCube Loader represents a PHP extension, its settings can be adjusted within the php.ini configuration file at your application server. To access it, click Config next to the appropriate node and select this file in the File Manager panel.
install ioncube loader cloud

At the very end of the opened file, specify the ioncube.loader.encoded_paths a directive with a path to the required destination directory or files as its value, e.g.:

ioncube.loader.encoded_paths = “/var/www/webroot/ROOT/index.php

Tips: For more complex customization of processed locations list, use the following formatting options:

  • to specify multiple entries, separate them with a colon “:”, stating plus “+” or minus “” prefix before each path to add/exclude the specified location correspondingly
  • if no prefix is given, a plus sign “+” is assumed  
  • for PHP 5.1 and later, multiple locations can be added within several lines, according to the following syntax:

ioncube.loader.encoded_paths = “/path1”
ioncube.loader.encoded_paths = ${ioncube.loader.encoded_paths}”:/path2″ and so on

Refer to the Loader User Guide for more information on how to define the required ionCube work area.

Do not forget to Save the changes and be sure your data is safe now.

  • 0 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

How to Enable PHP Extensions

1.Click on config button for your app server.  2. Within the opened configuration tab, click...

Deploy PHP Project Via GIT SVN

Deploy PHP Project via GIT/SVN You can host any public or your private PHP project at...

How to Check Change PHP Version in Apiqcloud

How to check PHP Version in Apiqcloud:   After making new Environment click on “Change...

MariaDB PHP connection

Connection to MySQL/MariaDB for PHP MySQL and MariaDB are highly popular open-source...

MySQL PHP Connection

Connection to MySQL/MariaDB for PHP MySQL and MariaDB are highly popular open source...