Server Fault is a question and answer site for system and network administrators. 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

Is it possible to generate a unique ID based on server hardware/OS? I want to generate license keys for my PHP web app based on customer server, just like Atlassian JIRA does.

Thanks for your help.

share|improve this question
I think your licensing model is Ass. Just sayin' – Tom O'Connor Mar 17 '12 at 10:43

I don't know the final solution but if it's Linux I think you can use lshw tool to read serial numbers of disks, processor, motherboard and other hardware devices and make hash (checksum) from combination of these info.

share|improve this answer
And then someone who wants to get around your licence check puts in a customised version of lvhw that returns whatever values are necessary to pass the key check. – womble Mar 17 '12 at 9:19
@womble - this is my checksum (You don't know how i made it), "09a366cc2ef30136d84804239d9b2875b68fd368", tell me what lshw should return... – jamzed Mar 17 '12 at 9:26
I rather think you miss womble's point, which is that once you've cut one legitimate license for a given lshw output, that license can be used on any number of other machines by suborning their lshw system calls. The same trick applies to using MAC addresses. – MadHatter Mar 17 '12 at 9:31
lshw is only one part of the solution... I thought about something like that – jamzed Mar 17 '12 at 9:39
Jamzed, in a closed-source operating system like Windows you can do that, and given trusted hardware, you can even rely on it. In a free operating system like Linux, you can't; free software is about doing what the platform owner wants, not what the software vendor wants, and it's usually quite good at it. – MadHatter Mar 17 '12 at 11:09

I think a better way is to code an EXE in any other language that gets the HWID from the server, and then have your PHP script exec() the EXE, if the output from the EXE matches then you run the script... If not, you show an error.

You might want to use blenc_encrypt() in PHP at the very least so that you can prevent users from going in and changing "if (systemhwid == validhwid)" to "if (1 == 1)"

A better option for encryption is to use IonCube (I think it's Ioncube that encrypts PHP files) but unfortunately it costs lots of money.

Search for the blenc_encrypt() function

share|improve this answer
In order to keep in line with the they want a straight answer, no BS statement you made, I edited out that paragraph as it's not relevant to the answer. – gparent Feb 24 '15 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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