Method 1 (This answers your question on the title):
let www-data be a admin in your server.
adduser www-data sudo
Then remove the sudo password while executing commands
Reference: Execute sudo without Password?
sudo visudo
In the bottom of the file, type the follow:
www-data ALL=(ALL) NOPASSWD: ALL
Note: there is a VERY high security risk, hackers may shutdown you server, do anything you can imagine to your server! Do this at your own risk
Method 2:
Write a service(with something other than PHP or Python) and run as root/admin user, once it's called, kill all python on your server.
Method 3:
A stupid method: let your Python create a empty file some where on start up, set that file permission to 777 so that any user can delete it. check if file exist every 5 seconds, if not exist, exit itself.
Finally, If your want to stop your python, just let php delete that file.
Method 4:
I just noticed, www-data will run you python script as itself, why not you can't kill it? just have a try.