I am making an android application in which I am first uploading the image to the server and on the server side, I want to execute a Python script from PHP. But I am not getting any output. When I access the Python script from the command prompt and run python TestCode.py it runs successfully and gives the desired output. I'm running Python script from PHP using the following command:
$result = exec('/usr/bin/python /var/www/html/Source/TestCode.py');
echo $result
However, if I run a simple Python program from PHP it works.
PHP has the permissions to access and execute the file.
Is there something which I am missing here?
First Check your python PATH using "which python" command and check result is /usr/bin/python. 
Check your "TestCode.py" if you have written #!/usr/bin/sh than replace it with #!/usr/bin/bash.
Than run these commands 
exec('/usr/bin/python /var/www/html/Source/TestCode.py', $result);
echo $result
Execution of a Python Script from PHP