Extension license for local project. Yes, no?

If you’re working for a client for a while there is a high probability that you got request to implement some commercial extension. Or perhaps you’re store owner and you bought specific extension but you now want to test it firstly locally, before you deploy it on your live site.
In this short post I’ll give you an idea of what you can do to “make it work” locally in case when you have valid license for the extension and extension doesn’t work on your local project. If you’re interested on what you can do in situation like this one, keep reading.
Long story shortly, you bought extension and you set the license for www.example.com and example.com domain(s). Maybe you also needed to provide your external IP address (1.2.3.4) for your domain(s).
In case if you have also IP address included for the license, PHP has for you Superglobal variable $_SERVER. If you look in PHP manual you’ll see:
$_SERVER['SERVER_ADDR'] 'The IP address of the server under which the current script is executing.'
As you already know, you can change value of it.
Now, if you open your index.php file and if you add line:
$_SERVER['SERVER_ADDR'] = '1.2.3.4';
somewhere before Mage::run()… you’ll modify your local IP address to 1.2.3.4. Save changes in index.php
We’re halfway there. Next thing to do is to point domain www.example.com to root of your local (127.0.0.1) Magento project. You can leave example.com to point on live server so you don’t loose your ping right away.
If you enable your extension locally you should see everything regularly. Now, after you successfully test it, you can deploy your extension on your live site without any fear that something will be broken.
Sure, you should read license before to make sure that you can use this hack…
I hope this post will help you with testing.
Additionally, your extension could be ‘encrypted’, or more precisely encoded. You don’t want to deploy that code on live site, right? I wrote once about Base64 encoding/decoding and I said that I’ll give you some sample script how can you decode most of encoded extension around.
Stay tuned!
5 comments
My Team were created a customized extension, usually we encrypted the extension base code and install it on my client’s websites so that they cannot re-use the extension in other domains.
I have added patch for validating domain in encrypted code.
Now i am looking for some other method through which i can stop others using my code other than encryption.
I heard about setting up license key to validate user’s domain.
There are some extensions encoded with ionCube, witch makes even hard to debug, and detect where is breaking…
Agree with both of you. This post was more like an idea about what you can do in similar situations.
agree with beeplogic, search for alternate extension if it only allows one licence per domain.
I feel that extensions that impose these types of restrictions should be avoided. They may also tend to “phone home” to validate such restrictions, which is an even greater annoyance.