Trying to exec Python script using PHP -


i'm trying exec python script using php, python seems dont work when exec php.

i tryied code test

$cmdresult = shell_exec("ls & /usr/local/bin/python2.7 --version & echo done"); 

returned:

done license example.py 

when exec on console (shell):

[root@local folder]# /usr/local/bin/python2.7 --version python 2.7.6 

anyone have idea whats problem?

aditional info:

[root@local folder]# ls -all /usr/local/bin/py* -rwxr-xr-x 1 root apache      84 jul 21 21:53 /usr/local/bin/pydoc lrwxrwxrwx 1 root root        24 jul 21 21:43 /usr/local/bin/python -> /usr/local/bin/python2.7 -rwxrwxrwx 1 root apache 4669791 jul 21 21:53 /usr/local/bin/python2.7 -rwxr-xr-x 1 root apache    1674 jul 21 21:53 /usr/local/bin/python2.7-config 

in shell command try using && so:

ls && /usr/local/bin/python2.7 --version && echo done 

so code read

$cmdresult = shell_exec("ls && /usr/local/bin/python2.7 --version && echo done"); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -