Masum Nishat
Masum Nishat

Reputation: 368

Class 'COM' not found in php 5.5.11

I have no Idea, why i see this, I am using php 5.5.11 (php-cgi.exe) , windows 7 ultimate x86, nginx 1.5.10 According to this I don't need php_com_dotnet.dll to enable my php.ini.

Fatal error: Class 'COM' not found in pertama._.php on line 6

in pertama._.php i have,

function get_server_load() {
    if (stristr(PHP_OS, 'win')) {
        $wmi = new COM("Winmgmts://");
        $server = $wmi->execquery("SELECT LoadPercentage FROM Win32_Processor");
        $cpu_num = 0;
        $load_total = 0;
        foreach($server as $cpu){
            $cpu_num++;
            $load_total += $cpu->loadpercentage;
        }
        $load = round($load_total/$cpu_num);
    } else {
        $sys_load = sys_getloadavg();
        $load = $sys_load[0];
    }
    return (int) $load;
}

Upvotes: 2

Views: 1135

Answers (1)

Masum Nishat
Masum Nishat

Reputation: 368

I have got a solution after all.

for php 5.5 you don't need to have any php_com_dotnet.dll in your ext directory.Just add

extension=php_com_dotnet.dll

in your php.ini this will solve every problem.

Upvotes: 1

Related Questions