PHP and Windows WMI, CPU temperature and false readings?

I wrote this PHP function:

<?php
//windows cpu temperature
function win_cpu_temp(){
    $wmi = new COM("winmgmts://./root\WMI");
    $cpus = $wmi->execquery("SELECT * FROM MSAcpi_ThermalZoneTemperature");
    foreach ($cpus as $cpu) {
        $cpupre = $cpu->CurrentTemperature;
    }
    $cpu_temp = ($cpupre/10)-273.15 . ' C';
    return $cpu_temp;
}
echo win_cpu_temp();
?>

My problem is that the script displays 59.55 Cwhich I thought was correct. I checked this value a few hours later, and it is exactly the same. I just set the processor to 90% video compression for ten minutes, and this value remains the same.

Can someone help me find the "true" value for this function?

I read (to no avail): MSAcpi_ThermalZone Temperature class not showing actual temperature

How, say, "Core Temp" gets its values? The same computer, it reports from 49 to 53 degrees Celsius.

+3
source share
1 answer

, MSAcpi_ThermalZoneTemperature , , .

Win32_TemperatureProbe , - .

MSAcpi_ThermalZoneTemperature, Win32_TemperatureProbe, , , http://openhardwaremonitor.org/, WMI .

, CPU Core temp PHP script:

function report_cpu_temp(){    
    $wmi = new COM('winmgmts://./root/OpenHardwareMonitor');
    $result = $wmi->ExecQuery("SELECT * FROM Sensor");
    foreach($result as $obj){
        if($obj->SensorType == 'Temperature' && strpos($obj->Parent, 'cpu') > 0)
            echo "$obj->Name ($obj->Value C)"; // output cpu core temp
        else
            echo 'skipping ' . $obj->Identifier ;
        echo '<br />';
    }
}

, .

+4

All Articles