I'm trying to run a Python script from PHP using the following command:
$cmd="sudo /var/www/html/test/class.sh /tmp/tib.jpg"
exec($cmd,$output,$return)
So, i write the command into a shell script "class.sh"
cd $my_work_dir
/usr/bin/python3 -m src.inference.classify file $1
But, i can run the script in command line "php /var/www/html/test/class.sh", but that can't run in the browser with output. I use the proc_open capture the part of error:
array ( 'stdout' => '', 'stderr' => 'Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.4/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/bmk/1\\udce6\\udc96\\udc87\\udce6\\udca1\\udca3/0\\udce7\\udca0\\udc94\\udce5\\udc8f\\udc91/Dog/Dog-AI/dog-breeds-classification-master/src/inference/classify.py", line 7, in import tensorflow as tf File "/usr/local/lib/python3.4/dist-packages/tensorflow/__init__.py", line 24, in from tensorflow.python import * File "/usr/local/lib/python3.4/dist-
I think , because,Python can not locate my python library. I also refered another stackoverflow Running a Python script from PHP , that is not work for me.
Can anybody help me?