gpt4 book ai didi

python - Apache mod_wsgi 32 位/64 位 Python 兼容性

转载 作者:太空宇宙 更新时间:2023-11-04 06:14:27 26 4
gpt4 key购买 nike

我使用 Zend Studio/Zend Server 开发基于 PHP 的网站,但现在我正在学习 Python 类(class),并且我想学习 Django。

我有一台 Windows 7 AMD-64 机器,我使用的是 64 位 Python 2.6(类(class)要求 2.6 版),这部分工作正常。

我的问题是尝试将 mod_wsgi 添加到我的 Zend Server 的 32 位 Apache 安装中。我已经为 Python 2.6 下载了几个版本的 mod_wsgi 32 位 Windows 二进制文件,并将它们复制到 C:Program Files (x86)\Zend\Apache2\modules 目录,编辑 httpd.conf 并添加:

LoadModule wsgi_module modules/mod_wsgi.so

重新启动 Apached2.2-Zend,然后测试 mod_wsgi 是否在命令提示符下加载:

httpd -t -M

但是,mod_wsgi 不会出现在已加载模块的列表中。

我最终认为这可能行不通,因为我无法将 64 位 Python 2.6 与 32 位 ZendServer Apache2.2 混合搭配。

所以这是我的问题的核心:

我可以安装 64 位版本的 Apache 2.2 并与 ZendServer Apache2.2 同时运行吗(但是配置 64 位版本,这样它就不会监听与我的 ZendSever Apache2.2 相同的端口) 所以我所有的本地 PHP 虚拟主机仍然有效?也许我会更幸运地让 mod_wsgi 加载这个 Apache?

或者,安装 32 位版本的 Python 会更好吗(可能是像 Python 2.8 这样的更高版本,因为我的类(class)作业只需要 Python 2.6,而且我正在尝试让 Django 只为我自己的网站工作网站开发)?这会允许我的 ZendServer Apache2.2 加载 mod_wsgi 吗?另外,如果我的 Windows 7 机器上安装了这两个 Python,Apache 如何确定它应该使用哪个 Python 安装?

最佳答案

Can I install a 64-bit version of Apache 2.2 and run that at the same time as ZendServer Apache2.2 (but configure the 64-bit version so it doesn't listen on the same ports as my ZendSever Apache2.2)

是的,你可以。

您已经考虑过最困难的问题:它不能在相同的端口上监听。

一个相关的问题是有些人的网络不允许他们建立到端口 8080 的传出连接;如果你想处理这个问题,你需要设置你的 ZendServer 作为其他服务器的转发代理。但仅此而已。

唯一的另一个问题是您需要确保您的两个 Apache 副本不会尝试共享相同的配置文件等(您可能也不希望它们都在您的 PATH 中)。


Or, would it be better to install a 32-bit version of Python (probably a higher version like Python 2.8

没有 2.8,也永远不会有。最后一个 2.x 版本是 2.7(尽管它继续得到错误修复,并且最高为 2.7.5)。如果你想要更高的东西,你必须去 3.x。如果您需要的一切都在 3.3 上运行(Django 1.5+ 也可以),并且您愿意了解这些小的变化,那么您应该考虑这一点。但是,如果您想坚持使用已知的知识,请获取 2.7.5。

Would that allow my ZendServer Apache2.2 to load mod_wsgi?

好吧,如果您使用 Python 2.6 的 mod_wsgi 并安装 Python 2.7 或 3.3...或者使用原生 Python 的 mod_wsgi 并安装 Cygwin Python ……等等。但我怀疑您已经知道了(鉴于“我已经下载了几个版本的 mod_wsgi 32 位 Windows 二进制文件,适用于 Python 2.6”)。

除此之外,是的。只要一切都正确构建和配置,它就会工作。 (我不知道你下载并安装了哪些特定的软件包,所以我当然不能保证它们是否有效。)

Also, how does Apache figure out which installation of Python it should be using if I have both on my Windows 7 machine?

这是可配置的。我相信默认是使用它首先在您的 PATH 上找到的任何内容,或者使用在您的注册表设置中显示为“默认 python 2.x”的任何内容,如 Python 命令行启动器所使用的在 PEP 397 中描述. (当然,如果该 Python 不是它的构建对象,它将无法启动。)

关于python - Apache mod_wsgi 32 位/64 位 Python 兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16660305/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com