php无法从一个上层目录执行我的python脚本

python

import os
import sys

if len(sys.argv) > 1:
  output = ""
  for i in range(1, len(sys.argv)):
    output = output + sys.argv[i] + ' '
else:
  output = "no argument found"

print "Hello World!!!"
print output

php

<?php
$data = "Testing";
exec("python SA/test.py $data", $output, $ret);
foreach($output as $result)
    echo $result."<br/>";
echo $ret;
?>

My python script file is located in SA folder which is same directory with my current php file. My python script work fine in terminal but when I execute it through php, $result show empty and $ret show 2 on screen. Anyone know why it happened in this way? Any solutions?

Addition: The python script also work fine if it is located in same folder with the that php file.

I just found out a solution to solve it. Just change the permission of the folder with the command chmod 777, then everything work fine now.