Extension license for local project. Yes, no?

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!

You made it all the way down here so you must have enjoyed this post! You may also like:

Minify your CSS and JavaScript code! Mladen Ristic
, | 4

Minify your CSS and JavaScript code!

How to keep your CMS blocks organized (and not go insane) Adrian Bece
Adrian Bece, | 10

How to keep your CMS blocks organized (and not go insane)

Choosing a right event to observe Zvonimir Buric
Zvonimir Buric, | 16

Choosing a right event to observe

5 comments

  1. 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.

  2. Agree with both of you. This post was more like an idea about what you can do in similar situations.

  3. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.