【问题标题】:Apache 2.4 failing to load mod_wsgi.so on YosemiteApache 2.4 无法在 Yosemite 上加载 mod_wsgi.so
【发布时间】:2015-02-03 02:05:54
【问题描述】:

问题

使用 OS X Yosemite 和 Python 2.7,我尝试遵循简单的 hello world in Flask with Apache WSGI,但在执行 apachectl -S 时收到此错误:

httpd: Syntax error on line 171 of /private/etc/apache2/httpd.conf: Cannot load libexec/mod_wsgi.so into server: dlopen(/usr/libexec/mod_wsgi.so, 10): image not found

我尝试过的

首先,我将文件与其他mod_* 文件放在/usr/libexec/apache2/ 中。其次,我尝试关注Graham Dumpleton's answer并验证以下步骤:

1.您没有隐藏扩展并且已经添加了两次扩展。

gwg$ file /usr/libexec/apache2/mod_wsgi.so
/usr/libexec/apache2/mod_wsgi.so: Mach-O 64-bit bundle x86_64

2。 mod_wsgi.so 文件对任何 Apache 服务用户都是可读的。

我不确定如何执行此操作,但我只是针对其他 .so 文件检查了该文件的权限。例如:

gwg$ ls -l mod_vhost_alias.so 
-rwxr-xr-x  1 root  wheel  19472 Sep  9 18:11 mod_vhost_alias.so

和

gwg$ ls -l mod_wsgi.so 
-rwxr-xr-x  1 root  wheel  209564 Dec  4 17:05 mod_wsgi.so

3.你的 Apache 是 32 [64] 位。

I'm not sure how to do this.

4.你的 Python 是 32 [64] 位。

每this SO answer:

>>> import struct
>>> print struct.calcsize("P") * 8
64

5.你的 Python 是为所有用户安装的,而不仅仅是你安装它的用户。

gwg$ sudo su -
root# python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

问题

有什么帮助吗?提前致谢。

【问题讨论】:

    标签: python apache mod-wsgi


    【解决方案1】:

    使用brew 是我在 Mac OS X 上运行wsgi 最简单的方法。 这是顺序。

    1. brew tap homebrew/apache
    2. brew install mod_wsgi
    3. 如有必要xcode-select --install
    4. 您必须手动编辑 /etc/apache2/httpd.conf 以包含 LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.X/libexec/mod_wsgi.so
      • 截至 2014 年 12 月,X 为 5,但请按照屏幕上显示的说明进行操作
    5. 检查是否一切正常
      • httpd -t => 语法正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-16
      • 1970-01-01
      • 1970-01-01
      • 2016-04-17
      • 1970-01-01
      • 2014-12-16
      • 2018-02-01
      相关资源
      最近更新 更多