Many developers worry that their PHP script will be copied or shared without permission. The best-known way to protect it is to encode the files with ionCube.
What is ionCube? #
ionCube is a well-known tool for protecting PHP software. It has two parts:
- ionCube Encoder: a paid program the developer buys. It converts PHP files into an encoded format without the original source code. Depending on the edition, files can be locked to a domain, an IP address or an expiry date.
- ionCube Loader: a free PHP extension installed on the hosting. It reads and runs the encoded files.
How do you encode your files? #
- Choose how to encode: buy your own copy of ionCube Encoder from the official ionCube website, or use the online encoder on the same site.
- Pick the PHP version: encode the files for the PHP version the script will run on, because a file encoded for one version may not run on another.
- Add restrictions if you need them: such as locking the script to a customer domain or an expiry date, if your edition supports it.
- Keep the original copy: the source cannot be recovered from encoded files, so store your unencoded copy somewhere safe.
Running encoded files on your hosting #
- Log in to cPanel and open Select PHP Version. For PHP settings, see our php.ini guide.
- Check the PHP version and choose the one the files were encoded for.
- Enable the extension in the Extensions tab, tick ioncube_loader. The change saves automatically.
- Test the script open your site and make sure it works.
Common errors and fixes #
- A message asking for the ionCube Loader: the extension is not enabled. Enable it using the steps above.
- A message that the file was encoded for another PHP version: switch PHP to the matching version, or ask the script owner for a copy encoded for your version.
- A licence or domain message: the script is locked to a domain or a date, and only the script owner can fix it.
If you have trouble running an encoded script on our hosting, open a support ticket and we will help you get it working. If you are choosing hosting for your script, compare plans in which hosting suits you.
Frequently asked questions #
Do you offer a file encoding service?
No. The ionCube Encoder licence does not allow encoding as a service for others, so the script owner encodes their files with their own copy or the ionCube online encoder. We provide hosting that runs encoded files.
Do ionCube-encoded files run on Hyyat Host hosting?
Yes, after you enable the ioncube_loader extension in cPanel and choose the PHP version that matches the encoding.
Does encoding fully stop code theft?
It makes the code much harder to read and edit, but no protection is complete. Protect your rights with a clear licence agreement with your customers as well.