3

i run shell in command line in 1 hours. I want use PHP script to stop it . I known its $pid is 2000 by use getmypid();

I used PHP script as: exec("kill 2000");exec("kill -KILL 2000"); exec("kill -9 2000"); posix_kill(2000,9); but can't kill it.

If in terminal, i simple use ~$ kill 2000 .But can't with php script .

1
  • sorry, i don't know this. Addtional info , shell run php script Commented May 11, 2011 at 22:18

2 Answers 2

2

If you're running PHP with safe mode on you'll have to change safe_mode_exec_dir to include the dirs of the kill binaries, you'll also have to use "su -c" to kill processes not owned as yourself. It also depends on whether exec() is in the list of disabled_functions in php.ini.

Sign up to request clarification or add additional context in comments.

2 Comments

Use <?php error_reporting(E_ALL); ini_set('display_errors', '1'); $output = exec("su -c kill 2000"); echo $output; ?> and see if an error appears.
I change to var_dump($output) ; return string '' (length=0). No warning, error.
0

Check your safe mode configuration in php.ini. See here for more information .

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.