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 (220.127.116.11) 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'] = '18.104.22.168';
somewhere before Mage::run()… you’ll modify your local IP address to 22.214.171.124. 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.