Restarting tor with php/exec

AdamC

╠══════&
Jun 10, 2012
1,410
18
0
I need to restart tor with php (after making changes to torrc periodically), from the command line I'd do
Code:
/etc/init.d/tor restart
and that works, but from php doing
Code:
exec('/etc/init.d/tor restart',$output);
results in a "Checking if tor configuration is valid ... failed!" error.

Anyone have a solution?
 


What user is the PHP script running under? Make sure it's root.

Maybe try specifying the location of the torrc file as well. So:

Code:
exec("/etc/init.d/tor -f /etc/tor/torrc restart", $output);