Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    239

    Any way to know which php script uses the most cpu?

    Is there a way that I could see which php script is using the most resources (cpu and memory) on my server?

    My load has been spiking all over the place..... between 0.5 and 20. it would be nice to know which script is responsible.

  2. #2
    You might try visiting the /server-status location when you notice a particularly high load. You'll have to enable this in httpd.conf.
    Code:
    LoadModule status_module modules/mod_status.so
    ExtendedStatus On
    <Location /server-status>
      SetHandler server-status
      Order Deny,Allow
      Deny from all
      Allow from YOUR_IP
    </Location>

  3. #3
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    239
    It wont tell me much about cpu/memory usage.... but thanks for the tip. Thats pretty neat.

  4. #4
    There is a CPU column... anyway, it tells you all the necessary information. You can see which files on which vhosts are being accessed most at the time you notice the problems. Also, pay special attention to the Req column.

    You might try using "time php /path/to/script.php" -- but that won't give you memory information. Do you really need memory though? Are you swapping? Just because you're processing a lot of information (high load averages), doesn't mean you have a memory leak or something.

  5. #5
    Hi,

    In Linux you can use the two commands to see which php script exactly uses the cpu....
    1. top
    2. pstree

    You should use the proc filesystem too with the above results.
    liwiplus Team,
    http://www.liwiplus.com
    The Support Sages

  6. #6
    Join Date
    Nov 2002
    Location
    WebHostingTalk
    Posts
    8,878
    * Moved to Technical and Security Issues

    Sirius
    I support the Human Rights Campaign!
    Moving to the Tampa, Florida area? Check out life in the suburbs in Trinity, Florida.

  7. #7
    Join Date
    Apr 2003
    Location
    NC
    Posts
    3,080
    phpsuexec can help but putting it on a live server may cause a lot of trouble.
    John W, CISSP, C|EH
    MS Information Security and Assurance
    ITEagleEye.com - Server Administration and Security
    Yawig.com - Managed VPS and Dedicated Servers with VIP Service

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •