How to uninstall 'mod-wsgi' from httpd (Apache/2.2.15) - CentOS 6.6

3,182 views
Skip to first unread message

Utkarsh Sinha

unread,
May 25, 2015, 4:40:49 PM5/25/15
to mod...@googlegroups.com
Hi,
My VPS configurations are:
  • CentOS 6.6
  • Apache/2.2.15
  • Python2.6 (default-comes with CentOS6)
  • Python2.7 installed in parallel
[root@server ~]# ldd  /etc/httpd/modules/mod_wsgi.so
        linux-vdso.so.1 =>  (0x00007fff9f3f5000)
        libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007fc8440b0000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc843e93000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fc843c8e000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007fc843a8b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fc843807000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fc843472000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc844685000)

Having run the above command, the results seem to indicate that mod_wsgi.so is still using the default Python2.6 and this may be the cause of the Syntax errors/conflict.

Which is why I want to remove my current mod_wsgi installation and re-install it with appropriate settings to use Python2.7 instead.

Please help if you know a way to uninstall mod_wsgi. Thanks in advance.

Graham Dumpleton

unread,
May 25, 2015, 7:26:03 PM5/25/15
to mod...@googlegroups.com
The command to uninstall the operating system supplied package for mod_wsgi depends on what the name of the package is and what type of package it is.

If the installed package was 'apache2-mod_wsgi' and 'yum' on Suse was used to install it, then the command, run with root privileges, which may work is:

    yum remove apache2-mod_wsgi 

If you don't know the name of the installed package, try:

    yum list | grep mod_wsgi

to see what it is.

Graham

Graham Dumpleton

unread,
May 25, 2015, 7:28:10 PM5/25/15
to mod...@googlegroups.com
Meant to say 'Centos' and not 'Suse'.

Graham

Utkarsh Sinha

unread,
May 25, 2015, 8:15:07 PM5/25/15
to mod...@googlegroups.com
FIXED IT/ This is how: 

So the background objective behind uninstalling mod_wsgi was to re-install it with the correct configurations and have 'libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007f9c547f4000)' show up when 'ldd  /etc/httpd/modules/mod_wsgi.so' command is performed.

Since I already had Python2.7 installed. 

# I reinstalled mod_wsgi-3.4 (without performing any un-installations)

[root@server ~]# cd ~
[root@server ~]# wget 
http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz
[root@server ~]# tar xvf mod_wsgi-3.4.tar.gz
[root@server ~]# cd mod_wsgi-3.4

# configured mod_wsgi with the installed python2.7
[root@server ~]#./configure  --with-python=/usr/local/bin/python2.7
[root@server ~]# make
[root@server ~]# make install

# The below two commands are very important. Replace /usr/local/lib with the folder where you have installed libpython2.7.so.1.0 if it is not in /usr/local/lib.

[root@server ~]# LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/python

[root@server ~]# ldconfig

# Restart Apache Server

[root@server ~]# service httpd restart


[root@server ~]# ldd /etc/httpd/modules/mod_wsgi.so

        linux-vdso.so.1 =>  (0x00007fffc0aa9000)

        libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007f03a5b20000)

        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f03a5903000)

        libdl.so.2 => /lib64/libdl.so.2 (0x00007f03a56fe000)

        libutil.so.1 => /lib64/libutil.so.1 (0x00007f03a54fb000)

        libm.so.6 => /lib64/libm.so.6 (0x00007f03a5277000)

        libc.so.6 => /lib64/libc.so.6 (0x00007f03a4ee2000)

        /lib64/ld-linux-x86-64.so.2 (0x00007f03a6133000)

Graham Dumpleton

unread,
May 25, 2015, 8:23:41 PM5/25/15
to mod...@googlegroups.com
On 26/05/2015, at 10:15 AM, Utkarsh Sinha <utkarshs...@gmail.com> wrote:

# I reinstalled mod_wsgi-3.4 (without performing any un-installations)

[root@server ~]# cd ~
[root@server ~]# wget 
http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz
[root@server ~]# tar xvf mod_wsgi-3.4.tar.gz
[root@server ~]# cd mod_wsgi-3.4

The latest version of mod_wsgi is 4.4.11. No one should be using mod_wsgi 3.4 or older any more due to a security issue.

Download mod_wsgi from:

# configured mod_wsgi with the installed python2.7
[root@server ~]#./configure  --with-python=/usr/local/bin/python2.7
[root@server ~]# make
[root@server ~]# make install

# The below two commands are very important. Replace /usr/local/lib with the folder where you have installed libpython2.7.so.1.0 if it is not in /usr/local/lib.

[root@server ~]# LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/python

[root@server ~]# ldconfig

The better way if the Python shared library is not installed in a standard location is run set LD_RUN_PATH at the time of compilation only.

./configure  --with-python=/usr/local/bin/python2.7
LD_RUN_PATH=/usr/local/lib make
make install

This will embed the non standard directory location into the mod_wsgi.so file so you do not have to pollute the system configuration of directories to check for shared libraries, nor set LD_LIBRARY_PATH at the time you run the program, which for Apache is usually difficult.

This shouldn't usually be needed for /usr/local/lib as I believe most Linux systems will look there anyway.

Graham

Utkarsh Sinha

unread,
May 25, 2015, 8:45:13 PM5/25/15
to mod...@googlegroups.com
Hi Graham,
I hope Python2.7 doesn't have any issues supporting the latest version of mod_wsgi - 4.4.11. Or would it?? 

I actually am looking forward to deploying a Django project using Apache with mod_wsgi. But I was facing some syntax issues with mod_wsgi. I guessed it was because my mod_wsgi wasn't compatible with Python2.6. 
Hence the entire "Configuring Mod_wsgi to run with Python2.7" ordeal. 

Utkarsh

Graham Dumpleton

unread,
May 25, 2015, 8:49:58 PM5/25/15
to mod...@googlegroups.com
Both Python 2.6 and 2,7 should work fine.

A common problem people face is that mod_wsgi can only be compiled for one specific Python version. Thus if you are using system package for mod_wsgi it may not be compiled for the version of Python you want t use if the system version of Python is old. You therefore need to install mod_wsgi compiled for the correct version.

Graham

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Utkarsh Sinha

unread,
May 25, 2015, 8:54:02 PM5/25/15
to mod...@googlegroups.com
Exactly Graham! That was exactly my problem. That even though I had both the installations of Python, mod-wsgi was always choosing python2.6 to run and my Django venv was running py2.7.
Thanks anyways Graham. Appreciate your help! Kudos!

From: Graham Dumpleton
Sent: ‎5/‎26/‎2015 6:19 AM
To: mod...@googlegroups.com
Subject: Re: [modwsgi] Re: How to uninstall 'mod-wsgi' from httpd(Apache/2.2.15) - CentOS 6.6

You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/F_eQkxKEcGM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages