Skip to main content

Excessive Resource usage by PHP : How to find the exact cause?

Comments

9 comments

  • Infopro
    Yesterday I adjusted an included PHP file (included into index.php):

    Out of curiousity, if you reverse these changes does the issue go away?
    0
  • martin MHC
    Out of curiousity, if you reverse these changes does the issue go away?

    No. reverting the changes does not cease the notifications. Even if it did, I'd still like to know how the best way of finding which part of a file causes this issue, if it's logged and if so where to find this log. Cheers
    0
  • Infopro
    Indeed. Have you checked the directory that file is in for a file called error_log?
    0
  • martin MHC
    Yes, there are no error logs that I've found, as I said. By your line of questions, I should maybe clarify that while this is an issue, my motive to post here is how to debug this and similar issues in the future; rather than simply getting a specific answer for this specific case (although that would also be good!). If the generated server error log is able to tell me which part of the file is causing the excessive usage? Thank you for your help though :)
    0
  • Infopro
    No clue.
    Yesterday I adjusted an included PHP file

    What did you change exactly?
    0
  • martin MHC
    No clue. What did you change exactly?

    Hello. I setup using mb_ functions for string work turning strlen into mb_strlen It is not something I would expect to use excessive resources and the publicfacing side of the pages works fine, such as there's no delay in page output etc. indicative of a code issue (such as infinite looping).
    0
  • cPanelMichael
    Hello, Is PHP-FPM enabled for this domain name? If so, you may also want to review the PHP-FPM error log at:
    /opt/cpanel/ea-php$$/root/usr/var/log/php-fpm/error.log
    Replace "ea-php$$" with the version of PHP assigned to the account. Thank you.
    0
  • martin MHC
    Hi Michael, Thanks for suggestion. PHP FPM is not installed in these accounts. PHP version is 5.6. I have resolved the issue itself by rebooting the server. But my query still remains in principle how to investigate exact causes in PHP scripts of excessive resource usage notifications. Cheers
    0
  • cPanelMichael
    But my query still remains in principle how to investigate exact causes in PHP scripts of excessive resource usage notifications.

    Hello, There's no set guidelines on how to determine the cause of a PHP script using excessive resources, but you may find the following StackOverflow discussions helpful: PHP and MySQL: Find out which file or query is causing heavy CPU load How to find which PHP script is leaking memory? Determining a PHP script's execution time find which function(file) causes server overload Additionally, the following thread is useful for troubleshooting overall load issues: Troubleshooting high server loads on Linux servers Thank you.
    0

Please sign in to leave a comment.