Apache 2.4 failing to load mod_wsgi.so on Yosemite
问题
brew tap homebrew/apache
brew install mod_wsgi
必要时xcode-select --install
您必须手动编辑/etc/apache2/httpd.conf以包含LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.X/libexec/mod_wsgi.so
检查一切正常
使用OS X Yosemite和Python 2.7,我尝试使用Apache WSGI跟随Flask中的一个简单的hello世界,但是在执行
1 | 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 |
我尝试过的
首先,我将文件与其他
1.您没有隐藏扩展名,并且已两次添加扩展名。
1 2 | gwg$ file /usr/libexec/apache2/mod_wsgi.so /usr/libexec/apache2/mod_wsgi.so: Mach-O 64-bit bundle x86_64 |
2.无论Apache服务用户是谁,都可以读取mod_wsgi.so文件。
我不确定确切如何执行此操作,但是我只是对照其他
1 2 | gwg$ ls -l mod_vhost_alias.so -rwxr-xr-x 1 root wheel 19472 Sep 9 18:11 mod_vhost_alias.so |
和
1 2 | gwg$ ls -l mod_wsgi.so -rwxr-xr-x 1 root wheel 209564 Dec 4 17:05 mod_wsgi.so |
3.您的Apache是32 [64]位。
1 | I'm not sure how to do this. |
4.您的Python是32 [64]位。
按照这样的答案:
1 2 3 | >>> import struct >>> print struct.calcsize("P") * 8 64 |
5.将为所有用户安装Python,而不仅仅是为您安装Python的用户。
1 2 3 4 5 6 | 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. >>> |
题
有什么帮助吗? 提前致谢。
对我而言,使用
这是顺序。
- 截至2014年12月,X为5,但只需按照屏幕上显示的说明进行操作
-
httpd -t =>语法确定