Apache 2.4 cannot load mod_wsgi.so on Yosemite
Problem
Using OS X Yosemite and Python 2.7, I am trying to follow a simple hello world in Flask with Apache WSGI , but I get this error when I execute 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
What i tried
First I put the file in /usr/libexec/apache2/
with other mod_*
files. Second, I tried to follow Graham Dumpleton's answer and check the following steps:
1. You have no hidden extensions and added the extension twice.
gwg$ file /usr/libexec/apache2/mod_wsgi.so
/usr/libexec/apache2/mod_wsgi.so: Mach-O 64-bit bundle x86_64
2. That the mod_wsgi.so file is readable by any Apache user.
I don't know exactly how to do this, but I was just checking the file permissions of other files .so
. For example:
gwg$ ls -l mod_vhost_alias.so
-rwxr-xr-x 1 root wheel 19472 Sep 9 18:11 mod_vhost_alias.so
and
gwg$ ls -l mod_wsgi.so
-rwxr-xr-x 1 root wheel 209564 Dec 4 17:05 mod_wsgi.so
3. That your Apache is 32 [64] bit.
I'm not sure how to do this.
4. That your Python is 32 bit [64].
In this SO answer ::
>>> import struct
>>> print struct.calcsize("P") * 8
64
5. To have your Python installed for all users, not just the user, you installed it as.
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.
>>>
Question
Any help? Thanks in advance.
source to share
Usage brew
was easiest to run wsgi
on Mac OS X. This is the sequence.
-
brew tap homebrew/apache
-
brew install mod_wsgi
- If necessary
xcode-select --install
- You have to manually edit / etc / apache 2 / httpd.conf to enable
LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.X/libexec/mod_wsgi.so
- X is 5 as of December 2014, but just follow the instructions that appear on the screen
- Check if everything is in order.
-
httpd -t
=> Syntax OK
-
source to share