you need to use the full path for python and for your file. you can find the first from which python command, which most likely displays "/ usr / bin / python", and you should already know the latter. so your command will look like this:
$mystring = exec('/usr/bin/python /home/user/testing.py');
and you have to make sure that your python script has all the appropriate permissions, because your web server most likely works as a different user, so the permissions should be "-rwxrwxr-x" or something close.
source share