The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to display httpd processes of current login user

Discussion in 'General Discussion' started by kamlesh_chaube, Jul 17, 2009.

  1. kamlesh_chaube

    kamlesh_chaube Registered

    Joined:
    May 25, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Sir,

    I am working in php. I have create cPanel plugin.
    I want display httpd processes of current login user.
    Using unix command ps -ef | grep httpd it give me following output

    OUTPUT :-

    root 23972 1 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    root 24017 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 24024 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 24025 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 24027 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 24028 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 24029 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 25862 23972 0 Jul06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 14286 23972 0 Jul07 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 14297 23972 0 Jul07 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    nobody 14298 23972 0 Jul07 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
    jholco 20017 20008 0 12:30 ? 00:00:00 sh -c ps -ef | grep httpd
    jholco 20019 20017 0 12:30 ? 00:00:00 grep httpd

    Current login user is jholco.
    I want to display only jholco's process. Please help me.
    How can i display it.

    Thanks,
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In a cPanel/WHM environment, Apache always runs as user nobody. However, PHP processes will run as the user if you are running SuPHP.
     
  3. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Wrong command entirely! ;)

    If you "ps -ef" the Apache server, the only thing you are going to get
    back is user "nobody" daemons that tell you pretty much nothing!

    You can call the queue information from Apache to see what
    is currently being viewed but that won't tell you which user ;
    only which web site and pages currently being viewed.

    If you want to see what scripts are being run by a particular
    user which is what it sounds like you are trying to do then you
    don't want to run any "ps" commands but rather you would want
    to "grep" the following log files for the username you want:

    Log that shows normal CGI scripts (perl) that have been run:
    Code:
    /usr/local/apache/logs/suexec_log
    Log that shows PHP scripts run if running as SuPHP:
    Code:
    /usr/local/apache/logs/suphp_log
    In addition to showing the full path of the script executed in the suphp_log,
    it also shows you the UID number for the user the script ran under and
    that can be cross referenced with the UID numbers in /etc/passwd if
    you want to make sure the script was indeed run from the user shown
    in the path such as "/home/(username)/...".
     
Loading...

Share This Page