shell_exec(python3 $ cmd)可以从php shell直接执行中正常工作,但是无法从apache服务器工作

时间:2018-04-11 13:54:40

标签: php python-3.x apache ubuntu-16.04 gdal

您好我有一段代码从php文件执行python3命令:

shell_exec('python3 /var/www/html/PlantDiseaseSystem/src/lib/py/riskcalc.py '.$riskValue[0].','.$riskValue[1].','.$riskValue[2].','.$riskValue[3]);

它工作正常,给我正确的结果。但是一旦我使用Javascript Post请求从apache服务器运行相同的php文件,它将无法正常工作!我检查了我的apache2错误日志,并显示以下消息:

Traceback (most recent call last):
  File "/var/www/html/PlantDiseaseSystem/src/lib/py/riskcalc.py", line 10, in <module>
    from osgeo import gdal
  File "/usr/lib/python3/dist-packages/osgeo/__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "/usr/lib/python3/dist-packages/osgeo/__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
  File "/usr/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: /usr/lib/python3/dist-packages/osgeo/_gdal.cpython-35m-x86_64-linux-gnu.so: undefined symbol: VSICurlClearCache  

在我看来,我在导入库时遇到了麻烦,为什么我能从shell中做到这一点呢?我正在使用Ubuntu 16.04。谢谢!

0 个答案:

没有答案