I am trying to run a python script from a webserver(apache) using php. I used the following command 
exec (python test.py $arg1 $arg2 , $output, $result)
It executes successfully when I put the test.py in the document root directory. However, I wanted to run the python script from another subdirectory so that it would be easy for me to manage the outout of the python script.
what the python script does is

creates a folder
copy a file from the same directory the python script resides into the folder created (1)
zip the folder

The document root and the subdirectory for the python script have the same permission.
since it keeps on looking for the files to be copied from the documentroot, it generates "no such file or directory" error (in the apache error log file)
if your python file and php file in same folder:
$command_to_run = "test.pyw $arg1 $arg2 , $output, $result";
 $response = shell_exec($command_to_run);
else:
$command_to_run = "<php_folder>/scripts/python/test.pyw $arg1 $arg2 , $output, $result";
 $response = shell_exec($command_to_run);
From which directory to run python Script in webserver