drz73366 2010-01-29 03:06
浏览 115
已采纳

在Python WSGI环境中运行PHP脚本

I have a simple PHP script that outputs a dir listing in XML format. I use it to let a flash slideshow know what files are available to show.

I've just added the flash to a website that's powered by Django and the PHP file is now served up as it is, not parsed.

It's in the directory with the images under my media directory.

The server I use runs plesk so I do my config for each domain in a vhost.conf file (which gets included into the main appache conf I think)

It looks like this:

WSGIScriptAlias / /var/www/vhosts/<domain>/conf/django.wsgi
Alias /media/ /var/www/vhosts/<domain>/httpdocs/media/

I thought this meant that requests for anything under / are passed django to handle.
Except when they are for /media/... then they are served by apache as normal from the specified dir.

That works for the images, but does not parse the PHP file.

What should I do?

  • 写回答

4条回答 默认 最新

  • dongquming3255 2010-02-13 04:27
    关注

    So it turns out the problem was two things, making it hard to find.

    Thanks Ignacio Vazquez-Abrams, I had my lines the wrong way around.

    Once that was solved, PHP would not serve my file because it was in a dir that was symlinked from outside the allowed path(s). I resolved this by turning off open_basedir restrictions for this vhost. My new vhost.conf is below.

    <Directory /var/www/vhosts/<domain>/httpdocs>
        php_admin_flag engine on
        php_admin_value open_basedir none
    </Directory>
    
    Alias /media/ /var/www/vhosts/<domain>/httpdocs/media/
    
    WSGIScriptAlias / /var/www/vhosts/<domain>/conf/django.wsgi
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度