Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I built a web application using PHP. Now, I want to sell this web application online for customers but I want to guarantee that only one customer (only one website) use this. Is there a way to make the script under a license (which I provide)?

share|improve this question

closed as too broad by gnat, GlenH7, MichaelT, Ampt, jwenting Aug 6 '14 at 7:08

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

short answer, no. Long answer, no. – jwenting Aug 6 '14 at 7:08

The simplest thing you could do is provide each user with a

$token = hash("WHIRLPOOL",$uniquely_identifying_string);

and ask for that token before actually serving your app to anyone. Picture that as a proof-of-buying, and treat it like so (enabling users to renew their token, for instance, whenever they find it appropiate)

EDIT Oh sorry I understood you wanted to sell your application as a service (pretty much the only sane way to charge for a script-language-based application).

In case you want to actually try to ship this to other people and have them be the only enabled user, you would need to make sure that

  1. Generate this token for every single download and have it inserted all throughout every module of your app in different, difficult to grep manners

  2. Dial home at as many points in your code as possible, carrying your token to make sure from your own log analysis that all requests with that token come from a single domain

  3. Require this token to provide app support

  4. Leave other types of code signatures you can easily search for so that you can recognize pirated copies

  5. Add logic bombs only exploitable with your private key (and make sure that remains true or noone will use your software due to soon-to-be-known exploits). This way you will be able to deactivate infringing websites.

And that would still not be 100% adequate.

You cannot realistically assume that your code will not be used ilegitimally anywhere as long as all the logic is sitting in cleartext in front of your client (and such is always the case in PHP, no matter how much you obfuscate things you´re only making the unencoding marginally more annoying for the cracker)

share|improve this answer
He want to ship the source code of the application and wants to ensure that this application is not installed on any other webspace/server. Your idea only makes sense for a webservice, which is installed on your servers. – Martin Lantzsch Sep 10 '13 at 5:37
Edited to reflect that. – Carlos Vergara Sep 10 '13 at 10:35

Yes you can ship your software with a license which disallows non permitted usage, but we know that out there are lots of people who copy and redistribute your software against the law and your license.

When adding some kind of domain and license verification to your application you have one problem - the php source code is open when you distribute it. So everyone can easily read and edit your source code and null the application in this way. Also the end of the story is redistributing the application...

But there is one way you could go.

ionCube Encoder encodes your PHP source code in unreadable fragments which can be only decoded and executed with an matching license key.

You can also use your own license scheme like an algorithmus which converts an user installed license token to the domain on which the application is allowed to execute. If the domain mismatches exit() the script execution.

But always keep in mind that there is no software and no license which protects your source code up to 100%. So write an application which is exciting, which is so good that your customer loves you and has no problem with giving you the money for good work ;-)

share|improve this answer
ionCube Encoder was hell of a software to me. I had to use it once for a shop system I purchased. Since then I hate it with great passion. My conclusion would be to not make your customers hate you. Personally I've seen way to much bad software being over-protective. We make a good living with a nearly-not-protected software, we sell. "Content is king". – Uwe Keim Sep 10 '13 at 6:31
I also don't like these mechanisms to protect software, I am an open source guy but if he wants to protect his software this way he can do it.We also used ionCube for some of our products and it was no problem, cause the most users had their own server and installing and configuring the ionCube loader and our application was done via our install script. – Martin Lantzsch Sep 10 '13 at 7:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.