php can't execute my python script from one upper directory


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 $data = "Testing"; exec("python SA/ $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.

-------------Problems Reply------------

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.

Category:php Views:6 Time:2019-02-10
Tags: php python

Related post

Copyright (C), All Rights Reserved.

processed in 0.082 (s). 11 q(s)