General developer forum

php-cgi.exe draining cpu resources

Picture of Yiannis Theodoulou
php-cgi.exe draining cpu resources


My moodle site started to act strange all of a sudden, it is slow and crushing now and then, i found that the problem was moodlecron getting processor to work overtime - i disabled it, i had an improvement but now cpu percentage is getting high again and as i understand this time php-cgi.exe is responsible for it.

My php version is 5.4 and i think updating PHP and Moodle version will resolve the issue, what do you guys think? Also cron is mandatory and i can't get it run correctly (runs as a scheduled task)

also sometimes when the slowing down of Moodle occurs i get this to my mail:

DESCRIPTION:   The SQL Server performance counter 'Lock waits' (instance 'Waits in progress') of object 'MSSQL$NUPSQL:Wait Statistics' is now above the threshold of 5.00 (the current value is 6.00).

Please help me on how to upgrade PHP - which i think it might resolve the issue

Average of ratings: -
Picture of Mark Johnson
Re: php-cgi.exe draining cpu resources
Core developersParticularly helpful MoodlersPlugin developers

Upgrading PHP and Moodle is certainly a good first step.  5.4 is no longer supported, and Moodle 3.1 which is the last version to support PHP 5.4 is in security-only support.  Upgrading PHP is somewhat beyond the scope of a Moodle development forum, so you'll probably be best served searching for instructions specific to your server platform. 

PHP 7 has been supported by Moodle since Moodle 3.0, so if you are on 3.1 you should be able to upgrade PHP, then upgrade to the latest version of Moodle.  However, if you are on an older version of Moodle you should upgrade to 3.1 first, then upgrade PHP, then upgrade to the latest version of Moodle. Refer to the Upgrade notes for the version you are upgrading to.  Back everything up before you start!

Average of ratings: Useful (1)