dtye7921 2013-07-31 16:56
浏览 61
已采纳

配置php以通过require识别shebang

I want to do something like that in php (running on apache2):

require("somecgi.py")

where somecgi.py is a python file with a valid shebang. My apache is configured to execute the cgi-script when opened directly in brower. But i can't bring php to recognize the script as a cgi-script and instead inserts the source code of the script. For campatibility with text based browsers i don't want to use frames. I googled about that problem and found that there is a configuration option cgi.check_shebang_line. I think this could be related to that, but i'm also very new to php and don't kno where to set this option.

My OS: linuxmint KDE 14 (Kubuntu 12.10 derivate)

  • 写回答

1条回答 默认 最新

  • douping7975 2013-07-31 16:58
    关注

    Read up on require / include. It will execute php code, not python code. In order to execute the python code you will need to run a shell_exec type command from php, which should execute the python code like you would call it from the shell.

    The gist, the include / require options are used for including php files to be parsed by the php engine. Including random files with commands that are not php will attempt to parse the file using the php engine.

    EDIT

    If the shell_exec is not what you are looking for, maybe a redirect is or you may have to elaborate on your question to get down to what you really need.

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

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助