I have been trying to install the latest version of mod_wsgi (3.3) since hours on my Mac. I'm on Snow Leopard and I have the versions of Apache (Apache/2.2.15) and Python 2.6.1 (r261:67515) that come with the system.
I downloaded mod_wsgi-3.3.tar.gz from http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-3.3.tar.gz
Extracted the file and executed the following through terminal:
./configure
make
sudo make install
I added LoadModule wsgi_module modules/mod_wsgi.so to my httpd.conf.
Restarted Apache by disabling and enabling Web Sharing from the control panel.
localhost stops working until I remove the line I added httpd.conf :(
Please help. Thanks in advance.
I use the homebrew installed version of mod_wsgi. That gives me a universal version of mod_wsgi that works with the vanilla apache.
➔ file `brew list mod_wsgi`
/usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so: Mach-O universal binary with 2 architectures
/usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
/usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so (for architecture i386): Mach-O bundle i386
The problem you had was the path to mod_wsgi.so. On OS X the appropriate line is
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
With the latest Mac OS and most recent HomeBrew, the package isn't available on HomeBrew.
However, if you have Python3 and Pip3 installed and configured on your Mac, you can load the package using:
pip3 install mod_wsgi
I had to first run the below command to get mod_wsgi installed
brew tap homebrew/apache
And then run
brew install mod_wsgi
On OS X 10.8 Mountain Lion, brew install mod_wsgi fails. This answer on stackexchange suggests the location of the XCode toolchain has changed. It fixed my problem and hopefully helps other people who end up here on 10.8 trying to install mod_wsgi.
I also encountered this error but I didn't want to use brew.
In my case the cause of the problem was in misconfiguration of python framework used for mod_wsgi that can be checked by
otool -L /usr/libexec/apache2/mod_wsgi.so
In my case it pointed to Python 2.7 framework while I was using Python 3.3 and my
python -> /usr/bin/python
also pointed to python 3.3 version.
In order to fix this, I removed already installed /usr/libexec/apache2/mod_wsgi.so .
Then reconfigured mod_wsgi with command:
./configure --with-python=/usr/bin/python --disable-framework
sudo make
sudo make install
This should work fine.
But in my case after executing make command I've got a warning about non existing Python framework folder. So I checked what was the real path of my Python framework folder and replaced it in the Makefile under LDFLAGS.
Changed from:
-L/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config
to
-L/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config-3.3m
Good way to check the Apache modules if it doesn't work, is:
apachectl -M
If some module causes the error, it will print it.
The below solution works for me for MacOS BigSur and Monterey:
Install MacPorts from https://www.macports.org/install.php
sudo port install mod_wsgi --> installs apache2, python3 among other things
apachectl location after install: /opt/local/sbin/apachectl
apache2 modules location: /opt/local/lib/apache2/modules/
httpd config location: /opt/local/etc/apache2/httpd.conf
Add this line to httpd.conf: LoadModule wsgi_module lib/apache2/modules/mod_wsgi.so
I wrote two tutorials about how to install Apache + MySQL + Python in Mac OS and Windows.
Maybe you can take a look.
[Tutorial] install Apache + MySQL + Python on Mac OS
http://fstoke.me/blog/?p=3583
[Tutorial] install Apache + MySQL + Python on Windows
http://fstoke.me/blog/?p=3600
Mac OS X comes with apache 2, to install mod_wsgi just install homebrew and run the following command.
*brew install homebrew/apache/mod_wsgi*
go to apache2/modules/ and search for mod_wsgi.so
after this goto apache2/conf/ and do
*sudo vim http.conf*
and add the following line
LoadModule wsgi_module modules/mod_wsgi.so
I was having trouble getting mod_wsgi to work as well even using different peoples advice and it wasn't working, so I finally used this website: https://pypi.python.org/pypi/mod_wsgi
Downloaded the mod_wsgi 4.5.15 file
Opened the file in a location I liked
Went to folder location in terminal
Did python3 setup.py install (or python if you're using a different version)
I have a MacBook Pro Version 10.12.5 in case this helps anyone.
Related
I just installed the latest version of Apache (2.4.43) using brew on Mac OS (10.14.5). (Using instructions from this site.) But after restarting the service, httpd -v still shows 2.4.34 running from the Mac OS default. The same old version is shown when I query apachectl -v.
Thinking that perhaps I needed to update with one more step, I ran brew update httpd but it said that "httpd 2.4.43 already installed."
I'm still pretty new to using brew, and this is my first time creating an Apache server, so any help here would be appreciated. Thanks!
Sorry - easy fix. I neglected to update my .bash_profile to include /usr/local/opt/apache2/bin.
This was clear after I ran which apachectl, and it displayed the default directory for the preinstalled version of Apache - /usr/sbin/apachectl.
I ended up stopping the default version and prevented it from starting again on boot:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Then, started the newly installed version, and it worked fine.
I am a new to web development.I have created Django(-v 2.2) web application and I want to deploy it on my linux server(OS Centos).After installation apache2, when I was going to install libapache2-mod-wsgi-py3, it says that no package available. Is there different name for libapache2-mod-wsgi-py3 for OS Centos?
It is always recommended to install mod_wsgi directly into the python3 package using pip3.
pip3 install mod_wsgi
If you install mod_wsgi into the OS, it could cause conflict and unexpected behavior.
Do you have apache2-dev installed?
Also, for mod_wsgi it is better to go the CMMI path (configure-make-make install) in order to compile it with the correct version and load it in Apache as a module. This worked for me on Debian VPS:
To do so,
wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.6.5.tar.gz
tar xvfz 4.6.5.tar.gz
cd mod_wsgi-4.6.5
whereis apxs
whereis python3
./configure --with-apxs=/usr/bin/apxs --with-python=/usr/bin/python3.5
make
sudo make install
Double check the path for apxs and python, and run make install as sudo.
When it’s all ready, check the last line of prompt results, as there will be a path to a file: /usr/lib/apache2/modules/mod_wsgi.so
To cleanup after installation, run:
make clean
If you need to build the module for a different version of Apache, you should run:
make distclean
If you have a httpd.conf file, you should edit and add this line:
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
If not, create it and paste that line, and edit /etc/apache2/apache2.conf. file, by adding this line:
Include /etc/apache2/httpd.conf
You don't need that file to configure apache, but you can create it if other software relies on it being there.
You should restart Apache and check the log
sudo tail /var/log/apache2/error.log
as there should be a line that says:
Apache/2.4.25 (Debian) mod_wsgi/4.6.5 Python/3.5 configured -- resuming normal operations
When I recently installed PHP56 via Homebrew, Apache would no longer start, with this error in the logs:
Cannot load /usr/local/opt/php56/libexec/apache2/libphp5.so into server: dlopen(/usr/local/opt/php56/libexec/apache2/libphp5.so, 10): image not found
Note: I'm running Apache 2.4 on Mac El-Capitan.
How can I resolve this error and get Apache running again?
I've seen this before. If you brew options php56, it says:
With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system
you have to install php with the --with-apache option. See brew options php56 for more details.
Thus, try uninstalling (brew uninstall php56) then reinstalling php56 with the flag --with-apache for Apache v2.4.x (--with-apache22 for Apache 2.2). Generally, you can check your Apache version by typing in command line: httpd -v.
My version is 2.4.18, so I would brew install php56 --with-apache, which creates the proper file path /usr/local/opt/php56/libexec/apache2/libphp5.so.
Now, it is properly compiled with Apache Handler module.
IMPORTANT: installing php56 with this option appears to also install httpd24. From a brew program stance, this makes sense. However, this may break your server set up. If you don't want to use brew's Apache install, do a brew unlink httpd24 after this.
To see additional brew build options, try brew options php56.
In my site I am getting an error : an error occurred while processing this directive
It was working fine before moving to the new server. So when I checked I found that mod_perl module is missing. So I tried to install it by downloading the module to the server and then tried to run using Perl Makefile.pl but it was asking for apache src and I was not able to find it. I can see /usr/bin/apache/ folder but no source file inside the folder.
So I tried to install the module from Cpanel but I got the following error:
The C compiler is not functional and auto repair failed. Perl module installs require a working C compiler. Please repair the C compiler and try again.
Please let me know how to install it as I have tried most of the cases searching the net.
Thanks in advance
It's probably best to use your distro's packaging system to install mod_perl, especially, if apache is installed from a package too.
Yum based systems:
yum install mod_perl
Deb based systems
apt-get install mod_perl
you may need to enable the module using a2enmod
Mostly gcc is either corrupted or not present on your system. Please try to re/install gcc on your system
sudo apt-get update
sudo apt-get install build-essential
On Redhat:
yum update
yum install devtoolset-2-toolchain
It seems like a problem with your installation of gcc. You're using CloudLinux, so you should use yum to reinstall gcc.
$ sudo -i yum install gcc
But you don't need gcc if you install the pre-build packages.
$ sudo -i yum install mod_perl
Either way, you're going to need to get to grips with package installation for your system - and for that you're going to need root access.
I`m trying to install mod_wsgi for Python 3.2 on Debian 6 (Squeeze).
First I installed libapache2-mod-wsgi-py3 from default repository, and it was for Python3.1, then I add to source.list
*deb http://ftp.de.debian.org/debian wheezy main*
and call apt-get install libapache2-mod-wsgi-py3 again. After that sys.version in wsgi returs 3.2.3.
Is it truly mod-wsgi works with Python3.2 or that just bug?
If wishing to use Python 3.2, you must compile mod_wsgi from source code out of the mod_wsgi source code repository. Last tar ball and binary packages from distros wouldn't support 3.2.