# Best way to allow PHP/Apache to access /usr/bin/sensors

## Philippe23

I've got a PHP script that runs /usr/bin/sensors show the temperature of the CPU on a webpage live.  I've upgraded to a Hardened kernel that doesn't allow this anymore.

What's the best way to allow this access?  sudo?  Is there a way to do it with ACLs?  Something else?

----------

## PeGa!

Hi, 

If you don't want to install a fully-fledged system monitor like Nagios or Cacti or something like that (IMHO they are flexible and robust but also a bit complex), you may simply read the data that sensors see.

This is an example in my home box.

```
box sys # cat devices/pci0000:00/0000:00:18.3/temp1_input

56500

box sys # sensors

k10temp-pci-00c3

Adapter: PCI adapter

temp1:        +56.5°C  (high = +70.0°C)

                       (crit = +99.5°C, hyst = +97.5°C)

```

You see, i've got a k10temp-pci-00c3 heat sensor, and I read the content of /sys/devices/pci0000:00/0000:00:18.3/temp1_input, and it gave me the same information (well, "unformatted") that sensors. I think that if you _ONLY_ want CPU heat data, that's the cleanest way you've got.

Best regards,

Paul.

----------

## Philippe23

Hey Paul,

Thanks for your answer.  (I actually do have Munin installed, but it only updates every minute or so: this is a more real-time reading.)

So that morphs the question to: What's the best way to allow PHP/Apache to access that file?

----------

## PeGa!

Hi!

According to some tests I did, apache user can access that file without any issue. This means that PHP also can access it, so everything is reduced to a fopen instruction  :Wink: 

Hth,

Paul.

----------

