dongsheng4126335 2017-11-23 21:44
浏览 346

当PHP中的shell_exec()执行脚本时,Python open()函数不起作用

I have a open() command in my Python script which opens the file data.json in my Apache serve running on Raspberry Pi in w mode. This script in turn is run by PHP using the shell_exec command. When the script is run alone, the Python code works. However, it does not function when run by PHP. Does anyone have any idea why this is happening, or is more information needed? Thank you in advance for your help!

  • 写回答

2条回答 默认 最新

  • dtmtu02882 2017-11-24 06:34

    Thank you to user2693053 for solving this problem:

    Sounds like a privilege issue, although I am not experienced enough with calling Python from php to know whether that could be an issue here.

    and yes, it is a privilege issue! I fixed the problem by doing the sudo chmod 777 * command in the /var/www/html directory.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!