Apache won't restart after inserting mod_wsgi

6,323

Solution 1

Check your modules directory for Apache to see if you have mod_wsgi available. Also since you're running Windows you'll be looking for a .dll file and not a .so (Unix specific).

Solution 2

Problems with starting up Apache generally arises for the following reasons.

  1. Python was not installed for all users of system, but was only installed for the user that did the installation.
  2. Apache, Python and mod_wsgi.so are not all 32 bit, or not all 64 bit. You cannot mix 32 and 64 bit versions, must all be the same.
  3. If mod_wsgi.so was a binary, it is not the correct binary for Python or Apache version being used.

Note that you cannot load module mod_python and mod_wsgi at the same time if they use different Python versions.

Where did you get your mod_wsgi.so binary from. You say you are using Apache 2.4 but there are no pre built mod_wsgi.so binaries available that I know of.

Share:
6,323

Related videos on Youtube

chris
Author by

chris

Updated on September 18, 2022

Comments

  • chris
    chris almost 2 years

    Python interested me as a web scripting language so I wanted to set it up on my testing server.

    Cannot get Apache to restart with mod_wsgi. Running xampp v win32-1.8 w/apache v2.4, python v2.7 32bit, on win7 64bit. The registry files I see for Python are in hkey_classes_root. I not sure if that should be right but there are none in the hkey_current_user. The one in hkey_local_machine says default value not set.

    This is what I get when I run apache_start.bat

    Apache 2 is starting ...
    httpd.exe: Syntax error on line 141 of C:/xampp/apache/conf/httpd.conf: Cannot load C:/xampp/apache/modules/mod_wsgi.so into server: The specified procedure could not be found.

    What I have added to httpd.conf:

    LoadModule wsgi_module modules/mod_wsgi.so
    
    WSGIScriptAlias /wsgi_handler "C:/xampp/wsgi/mywsgi.py"
    
    <Directory "C:/xampp/wsgi">
    Order allow,deny
    Allow from all
    </Directory>
    
  • chris
    chris over 11 years
    I guess I don't know where you are referring because this was installed with the prepackaged installer for windows and all the modules in the apache module folder are .so Just tried the same setup with mod_python, installed python 2.5 and followed the instructions on that site and does the exact same thing. when I comment out the LoadModule line it Apache works fine just like with the wsgi module. I now have both mod_wsgi.so and mod_python.so in C:/xampp/apache/modules
  • WinkyWolly
    WinkyWolly over 11 years
    That seems strange. Arguably it's "possible" but I've never seen it in an Apache deployment (inherently different formats of dynamic libraries..). Regardless the error you're showing is explicitly stating it cannot find your module - verify your paths / configuration in httpd.conf.
  • chris
    chris over 11 years
    Thanks for the help. Got it working finally. Changed version of xampp to 1.7.7 w/Apache 2.2
  • j0k
    j0k about 11 years
    Any resource for that?