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 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题