Can't get my Apache to work with mod_wsgi
<p>As per guide I downloaded the <a href="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/modwsgi/mod_wsgi-win32-ap22py27-3.3.so" rel="nofollow">mod_wsgi-win32-ap22py27-3.3.so</a>, renamed it to mod_wsgi.so and put it into the /modules folder of Apache.</p>

<p>Next I added the 'LoadModule wsgi_module modules/mod_wsgi.so' line to the httpd.conf.</p>

<p>When starting up Apache it hands me this error: "The requested operation has failed!"</p>

<p>This is the output of the error.log:</p>

<pre><code>Starting the Apache2.2 service
The Apache2.2 service is running.
] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 12:59:37 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 12:59:37 2016] [notice] Parent: Created child process 3420
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Child process is running
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Acquired the start mutex.
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Starting 64 worker threads.
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Starting thread to listen on port 80.
[Fri Oct 07 12:59:58 2016] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
[Fri Oct 07 12:59:59 2016] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
[Fri Oct 07 13:01:05 2016] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Oct 07 13:01:05 2016] [notice] Child 3420: Exit event signaled. Child process is ending.
[Fri Oct 07 13:01:06 2016] [notice] Child 3420: Released the start mutex
[Fri Oct 07 13:01:07 2016] [notice] Child 3420: All worker threads have exited.
[Fri Oct 07 13:01:07 2016] [notice] Child 3420: Child process is exiting
[Fri Oct 07 13:01:07 2016] [notice] Parent: Child process exited successfully.
[Fri Oct 07 13:07:27 2016] [warn] mod_wsgi: Compiled for Python/2.7.
[Fri Oct 07 13:07:27 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:07:27 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/3.3 Python/2.7.11 configured -- resuming normal operations
[Fri Oct 07 13:07:27 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:07:27 2016] [notice] Parent: Created child process 7712
[Fri Oct 07 13:07:28 2016] [warn] mod_wsgi: Compiled for Python/2.7.
[Fri Oct 07 13:07:28 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:07:28 2016] [notice] Child 7712: Child process is running
ImportError: No module named site
[Fri Oct 07 13:07:28 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 13:42:17 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 13:42:17 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:42:17 2016] [notice] Parent: Created child process 5752
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Child process is running
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Acquired the start mutex.
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Starting 64 worker threads.
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Starting thread to listen on port 80.
[Fri Oct 07 13:42:28 2016] [notice] Parent: Received restart signal -- Restarting the server.
[Fri Oct 07 13:42:28 2016] [notice] Child 5752: Exit event signaled. Child process is ending.
[Fri Oct 07 13:42:28 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 13:42:28 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:42:28 2016] [notice] Parent: Created child process 5828
[Fri Oct 07 13:42:28 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 13:42:28 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:42:28 2016] [notice] Child 5828: Child process is running
ImportError: No module named site
[Fri Oct 07 13:42:28 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 13:42:29 2016] [notice] Child 5752: Released the start mutex
[Fri Oct 07 13:42:30 2016] [notice] Child 5752: All worker threads have exited.
[Fri Oct 07 13:42:30 2016] [notice] Child 5752: Child process is exiting
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:43:17 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Fri Oct 07 13:43:17 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:43:17 2016] [notice] Parent: Created child process 1200
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:43:17 2016] [notice] Child 1200: Child process is running
ImportError: No module named site
[Fri Oct 07 13:43:17 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 14:01:14 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Fri Oct 07 14:01:14 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 14:01:14 2016] [notice] Parent: Created child process 6128
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 14:01:14 2016] [notice] Child 6128: Child process is running
ImportError: No module named site
[Fri Oct 07 14:01:14 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 14:01:24 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 14:01:24 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 14:01:24 2016] [notice] Parent: Created child process 8268
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Child process is running
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Acquired the start mutex.
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Starting 64 worker threads.
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Starting thread to listen on port 80.
[Fri Oct 07 14:01:29 2016] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Oct 07 14:01:29 2016] [notice] Child 8268: Exit event signaled. Child process is ending.
[Fri Oct 07 14:01:30 2016] [notice] Child 8268: Released the start mutex
[Fri Oct 07 14:01:31 2016] [notice] Child 8268: All worker threads have exited.
[Fri Oct 07 14:01:31 2016] [notice] Child 8268: Child process is exiting
[Fri Oct 07 14:01:31 2016] [notice] Parent: Child process exited successfully.
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Mon Oct 10 09:37:29 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Mon Oct 10 09:37:29 2016] [notice] Server built: Jul 10 2013 01:52:12
[Mon Oct 10 09:37:29 2016] [notice] Parent: Created child process 1012
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Mon Oct 10 09:37:29 2016] [notice] Child 1012: Child process is running
ImportError: No module named site
[Mon Oct 10 09:37:29 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Mon Oct 10 09:37:55 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Mon Oct 10 09:37:55 2016] [notice] Server built: Jul 10 2013 01:52:12
[Mon Oct 10 09:37:55 2016] [notice] Parent: Created child process 6368
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Child process is running
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Acquired the start mutex.
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Starting 64 worker threads.
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Starting thread to listen on port 80.
[Mon Oct 10 09:38:14 2016] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Oct 10 09:38:14 2016] [notice] Child 6368: Exit event signaled. Child process is ending.
[Mon Oct 10 09:38:15 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Mon Oct 10 09:38:15 2016] [notice] Server built: Jul 10 2013 01:52:12
[Mon Oct 10 09:38:15 2016] [notice] Parent: Created child process 7484
[Mon Oct 10 09:38:15 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Mon Oct 10 09:38:15 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Mon Oct 10 09:38:15 2016] [notice] Child 7484: Child process is running
ImportError: No module named site
[Mon Oct 10 09:38:15 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Mon Oct 10 09:38:15 2016] [warn] (OS 995)Der E/A-Vorgang wurde wegen eines Threadendes oder einer Anwendungsanforderung abgebrochen.  : winnt_accept: Asynchronous AcceptEx failed.
[Mon Oct 10 09:38:15 2016] [notice] Child 6368: Released the start mutex
[Mon Oct 10 09:38:16 2016] [notice] Child 6368: All worker threads have exited.
[Mon Oct 10 09:38:16 2016] [notice] Child 6368: Child process is exiting
</code></pre>

<p>I'm not sure what the problem is exactly since the mod_wsg is for Python 2.7 and I am using Python 2.7 (32 Bit) in Addition to Apache 2.2 (32 Bit).</p>

<p>Solved the issue.</p>

<p>I had to set the environment variables PYTHONHOME and PYTHONPATH for it to fix the 'ImportError: No module named site' error.</p>

<pre><code>set PYTHONHOME=c:\Python27
set PYTHONPATH=c:\Python27\Lib
set PATH=%PYTHONHOME%;%PATH%
</code></pre>

python apache mod-wsgi