Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:17:59+00:00 2026-06-06T15:17:59+00:00

I have a simple script, which tries to kill an already running process. I

  • 0

I have a simple script, which tries to kill an already running process. I am using posix_kill for the same. The script runs fine, if I run it from command shell, but doesn’t work when I run it from the browser.

<?php

    $taskid  = 33;
    killProcess($taskid);

    function killProcess($taskid) {
    $ppid = getPID($taskid);
    echo "process id -- $ppid\n";
    $pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);
    var_dump($pids);
    foreach($pids as $pid) {
            if(is_numeric($pid)) {
            echo "Killing $pid\n";
                posix_kill($pid, 15);
            }
    }

    }
?>

I always get the following output, which means that the script is executing fine, but the process does not get killed:
process id — 4632
array (size=3)
0 => string ” (length=0)
1 => string ‘4633’ (length=4)
2 => string ” (length=0)
Killing 4633

I checked out the apache “error.log” file, and found that for each run that I do from browser, and additional entry gets added as follows:
[Sat Jun 23 12:24:55 2012] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico

Unfortunately this error does not give me much information about what’s going wrong. I checked out the php.ini settings, and there doesn’t seem to be anything wrong (as per whatever limited understanding I have). I do not see posix_kill in the “disabled_functions” list etc or any other setting that should prevent me from executing process.

Would sincerely appreciate some help !!

Thanks,
Kapil

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:18:01+00:00Added an answer on June 6, 2026 at 3:18 pm

    The error message has nothing to do with your problem. It’s just the browser asking for your site’s icon, which you haven’t configured.

    Now, about the actual issue: the apache user likely doesn’t have permissions to kill your process. If the process was started under a different user account, you can’t kill it from within the web server. Imagine a multiuser system where any local user could log in and kill everyone else’s processes – that isn’t the Unix permissions model…

    You might want to use a limited sudo with exec, or otherwise assume permissions before sending the signal. Or you could have the process listen for the web server to do something, and then kill itself. Or, better yet, don’t use a web-serving language like PHP for systems-administration type tasks: use cron or a more appropriate tool.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Perl script which runs as a Linux daemon using an
Here I have a simple php script which displays some values from a database
I have a very simple python script that should scan a text file, which
I have this script which simply kills an app KEY_NAME=/some/path kill `ps -ef |
I have an AJAX request (using JQuery) that calls a PHP script which does
I'm doing a simple chat script and I have the killSession function which kills
I have a simple script which inserts values from a text file into a
I have had problems with a simple php script in which I can upload
I think this is quite simple. I have a working AJAX Jquery script which
I am uploading a running a simple batch script which downloads a file from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.