In this article we will talk about making license files using Ioncube PHP encoder. Ioncube Encoder Pro or Cerberus is required to generate license files that can be distributed to your customers.The entry level version of Ioncube Pro cannot generate licenses,pro/cerberus eliminates the re-encoding and redistributing the project for each customer.
First we need to look at how to prepare a project to be used with a license.
Preparing Project:
Let us say that we have our project in a folder called ‘testproject’, the simplest way to encode such would be to use the following command (ioncube_encoder5 is for PHP 5.x, ioncube_encoder is for PHP 4.x)
/ioncube_encoder$ ioncube_encoder5 /projects/testproject –into /encoded-project
The above will encode testproject into a new folder located under /encoded-project, no licensing or restrictions has been applied. To encode the project so that a license file is required you add:
/ioncube_encoder$ioncube_encoder5 –with-license testproject_lic.txt –passphrase yourpassphrasehere /projects/testproject –into /encoded-project
Note that there is a passphrase used, you must use a passphrase when specifying a license file to be searched, you will use the same passphrase when generating a license with make_license. With the options above the encoded files will search for a file called testproject_lic.txt, and will check the parent folder recursively until it finds it. If it is a valid license the script will execute normally. If it is not, you will get a simple error stating that the code has an invalid license.
Now you have a very brief explanation of how to encode a project to use with a license file. Next we have to make a license file (For example ‘testproject_lic.txt’).
Generating a License file with make_license:
The ionCube encoder folder has a make_license binary. To make the file:
/ioncube_encoder$ ./make_license –passphrase yourpassphrasehere –header-line ‘testproject Expires-on:2011-07-31’ –property “UserName=’some username'”
Your passphrase can be something like: ‘testproject’. Then you will get the following encoded data in the command line. Use it within the file: ‘testproject_lic.txt’:
testproject Expires-on:2011-07-31
—— LICENSE FILE DATA ——-
9Y3V61186Z+uGrX5DcQqIdWgEdxuAOu3
h7usu8PEYkJFQBEubdW17wMrsdxqPbbt
8F5hcVmWsv4GVqEMHIWAHifozetzDxUi
YYlvE0EBqXWm5xo/t3ZsSmoMQBJet/uV
iEogy8UXHR13AWRcHvmB6NOkeJZUrgHx
jouDIXLtRas3rd1ZVnYmY9w9OrtzESLB
rgKeS+hiA99dMG/r1Tu0G+47D6DRJrGN
76SOkzIpGxKD7RMP605iLZPptor7XbqF
/s+mMbabdSZrpp43KrrB6+eFSIAbt5Xz
pKPVKXrbHdaYIzwLK+fnIRzJMJ==
——————————–
Now you have the license file for the ‘testproject’. To add a domain restriction such as ‘www.example.com’ we would add –allowed-server option:
/ioncube_encoder$ ./make_license –passphrase yourpassphrasehere –header-line ‘testproject Expires-on:2011-07-31’ –property “UserName=’some username'” –allowed-server www.example.com
The above will make it so that the license is only valid on ‘www.example.com’. Time-based restrictions can be applied with –expire-in and –expire-on:
–expire-in 5d
–expire-in 4h
–expire-on 2012-07-31
The first would expire in 5 days, and second in 4 hours, the last one would expire on July 31st 2012.
Now you know how to make a license file with ioncube encoder for a php project. Try this and enjoy the licensing functionality with ioncube!
www.ihamna.no: This is a topic that's near to my heart... Many thanks! Where are your contact details though?".
Leave a Reply