By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,218 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,218 IT Pros & Developers. It's quick & easy.

Hard Disk Serial Number

P: n/a
PBI
I would like to know if it is possible to read, through php, the Hard Disk
Serial Number
or other serial number (cpu, motherboard etc... ).
Thanks.
Nov 13 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
PBI wrote:
I would like to know if it is possible to read, through php, the Hard Disk
Serial Number
or other serial number (cpu, motherboard etc... ).
Thanks.
Hi,

If you can come up with some command that produces them, you can pass that
command via shell_exec() and the likes, and catch the output.
Check www.php.net and search for shell_exec().
I wouldn't know of a command that produces the serialnumber, but if you know
such a command, you can use shell_exec() to execute it.

Of course this cannot be done on a clients machine, only on server where php
runs.

Regards,
Erwin Moller
Nov 13 '06 #2

P: n/a
Erwin Moller wrote:
I wouldn't know of a command that produces the serialnumber, but if you
know such a command, you can use shell_exec() to execute it.
If you're using Linux, hdparm and sdparm are your friends.

On the otherhand, if you use a recent 2.6 kernel, you don't have to run any
external programs, but read some file inside /sys/class/.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Si hay una probabilidad de que varias cosas salgan mal, saldrá mal la
que cause mayor daño.
-- Tercer Corolario de Murphy.

Nov 13 '06 #3

P: n/a

Ivn Snchez Ortega wrote:
Erwin Moller wrote:
I wouldn't know of a command that produces the serialnumber, but if you
know such a command, you can use shell_exec() to execute it.

If you're using Linux, hdparm and sdparm are your friends.

On the otherhand, if you use a recent 2.6 kernel, you don't have to run any
external programs, but read some file inside /sys/class/.
<snip>

As the OP wanted to get those information passed to php, it is possible
to get the required reading as part of REGEX string from those commands
or the file mentioned above. Extracting motherboard information can be
little tricky, I guess.
--
Raqueeb Hassan
Bangladesh

Nov 13 '06 #4

P: n/a
Anything that you execute using shell_exec() is going to execute on the
server, not the client. I'm failing to see what use the motherboard
serial number of the server is going to provide you with but that is
neither here nor there. How often is this number really going to
change? Wouldn't you be better off storing this stuff in say, an XML
file rather than trying to read it some how through php? That's just my
opinion, I almost never use shell_exec(), as it seems unnecessary to me
for almost any web app.

matt

Raqueeb Hassan wrote:
Ivn Snchez Ortega wrote:
Erwin Moller wrote:
I wouldn't know of a command that produces the serialnumber, but if you
know such a command, you can use shell_exec() to execute it.
If you're using Linux, hdparm and sdparm are your friends.

On the otherhand, if you use a recent 2.6 kernel, you don't have to runany
external programs, but read some file inside /sys/class/.

<snip>

As the OP wanted to get those information passed to php, it is possible
to get the required reading as part of REGEX string from those commands
or the file mentioned above. Extracting motherboard information can be
little tricky, I guess.
--
Raqueeb Hassan
Bangladesh
Nov 14 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.