Hi
I have some problem with the Apache 2.2/mod_wsgi/python installation on a 
centos 6.6 system too, so i reopened this discussion hoping to have some 
hints on how to solve my problems. First of all i would like to thanks in 
advice everyone. I must admit i almost new about linux, so i apologize in 
advice for some stupid questions. By the way, here it is my problem.
I followed the istsos tutorial to install it on a centos 6.5 machine. The 
machine comes with a python 2.6.6 installation (yum functionalities) and i 
can't update the python version, i need to keep it. So i installed 
mini-conda with a 2.7 python on the machine. The mini conda installation 
puts python under "/opt/anaconda/bin/python" . I followed the installation 
guide without problem untill the mod_wsgi installation. At the beginning i 
tried to use the mod_wsgi by the command "yum install mod_wsgi". Everything 
seemed to go right, so i connected to the admin page but nothing happened. 
So i gave a look to the httpd error_log file and here it is what i get:

[Fri Mar 13 12:48:08 2015] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/3.2 
Python/2.6.6 configured -- resuming normal operations
[Fri Mar 13 12:51:36 2015] [error] Traceback (most recent call last):
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/application.py", line 177, in executeWa
[Fri Mar 13 12:51:36 2015] [error]     op = factory.initResource(waEnviron)
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/walib/resourceFactory.py", line 52, in initResource
[Fri Mar 13 12:51:36 2015] [error]     from walib.istsos import istsos
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/walib/istsos/istsos.py", line 18, in <module>
[Fri Mar 13 12:51:36 2015] [error]     from walib import resource, utils, 
databaseManager, configManager
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/walib/resource.py", line 20, in <module>
[Fri Mar 13 12:51:36 2015] [error]     from walib import utils as ut
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/walib/utils.py", line 515, in <module>
[Fri Mar 13 12:51:36 2015] [error]     import psycopg2 # @TODO the right 
library
[Fri Mar 13 12:51:36 2015] [error] ImportError: No module named psycopg2
[Fri Mar 13 12:51:36 2015] [error] None
[Fri Mar 13 12:51:36 2015] [error] Traceback (most recent call last):
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/application.py", line 223, in executeWa
[Fri Mar 13 12:51:36 2015] [error]     from walib import resource
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/walib/resource.py", line 20, in <module>
[Fri Mar 13 12:51:36 2015] [error]     from walib import utils as ut
[Fri Mar 13 12:51:36 2015] [error]   File 
"/usr/local/istsos/walib/utils.py", line 515, in <module>
[Fri Mar 13 12:51:36 2015] [error]     import psycopg2 # @TODO the right 
library
[Fri Mar 13 12:51:36 2015] [error] ImportError: No module named psycopg2
[Fri Mar 13 12:51:36 2015] [error] None


In my opinion the problem is the mod_wsgi. It was compiled using a python 
2.6 .
So i get the mod_wsgi raw code from the mod_wsgi repository 
<https://github.com/GrahamDumpleton/mod_wsgi> . I then compiled the 
mod_wsgi using your guide (i'm a root user on the machine) 

make distclean
./configure --with-python=/opt/anaconda/bin/python
LD_RUN_PATH=/opt/anaconda/lib make
make install


The project was compiled succesfully and it looked installed rigthly too, 
but when i try to start the httpd service again, i get this error message:

"Starting httpd: Syntax error on line 1032 of /etc/httpd/conf/httpd.conf:
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a 
module not included in the server configuration
                                                           [FAILED]
"

Here it is my virtual host node (it's the same present in the guide)

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that 
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly. 
#ServerName www.example.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
        ErrorLog /var/log/httpd/error_log
        CustomLog /var/log/httpd/access_log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the # 
following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
        WSGIScriptAlias /istsos /usr/local/istsos/application.py
        Alias /istsos/admin /usr/local/istsos/interface
</VirtualHost>

Can you help me solving this problem? Thanks in advice

Costanzo


Il giorno giovedì 31 luglio 2014 12:00:29 UTC+2, Graham Dumpleton ha 
scritto:
>
>
> On 31/07/2014, at 4:49 AM, Derek Wilson <[email protected] 
> <javascript:>> wrote:
>
> Steve and  Graham,
>
> Your advice was helpful.  I also got it to work following  Steve's steps 
> as well as one other addition.  I compiled mod_wsgi with anaconda so:
>
> 0. shut down httpd with /etc/init.d/httpd stop
> 1. installed anaconda on /opt/anaconda
> 2.    added anaconda libraries to /usr/bin with
>      ln -sf  /opt/anaconda/lib/libpython2.7.so /usr/lib
>      ln -sf  /opt/anaconda/lib/libpython2.7.so.1.0  /usr/lib
>      /sbin/ldconfig
>
>
> The alternative to this would have been to build mod_wsgi using:
>
> make distclean
> ./configure --with-python=/opt/anaconda/bin/python
> LD_RUN_PATH=/opt/anaconda/lib make
> sudo make install
>
> 3. installed mod_wsgi source with:
>         ./configure --with-python=/opt/anaconda/bin/python
>        make
>       (sudo) make install
>
> 4.  added the anaconda path to /etc/sysconfig/httpd with:
>      export PATH=/opt/anaconda/bin:$PATH
>
>
> If this was necessary so that the correct Python run time was found, that 
> is, the lib directory, as the 'python' executable isn't actually run, you 
> are better off saying in Apache configuration:
>
> WSGIPythonHome /opt/anaconda
>
> 5.  started httpd again with success.  I also set SELINUX=disabled in 
> /etc/sysconfig/selinux but dont know if this is really an issue.
>
> On Monday, March 11, 2013 7:59:15 PM UTC-5, Steve Liang wrote:
>>
>> Thanks for the recommendation. It is working now.
>>
>> Here are the steps I've taken:
>> - reconfigure python 2.7.3 installation, with ./configure 
>> --prefix=/usr/local --enable-shared --with-system-expat --with-system-ffi 
>>  (My guess is --enable-shared was missing)
>> - configure the mod_wsgi with 
>> ./configure --with-python=/usr/local/bin/python
>> - WSGIPythonHome /usr/local
>>
>> I also reconfigured anaconda to /usr/local, but it is not used by 
>> mod_wsgi now.
>>
>> On Sunday, March 10, 2013 11:35:30 PM UTC-4, Graham Dumpleton wrote:
>>>
>>> Python installations are never installed under a 'lib' directory. They 
>>> would be installed under /usr/local.
>>>
>>> Where is the 'python' executable for this other existing Python? Is it 
>>> in /usr/local/bin?
>>>
>>> If it is and you run /usr/local/bin/python and print sys.prefix what do 
>>> you get? It should be /usr/local.
>>>
>>> So when installed under /usr/local, you will end up with:
>>>
>>> /usr/local/bin/python
>>> /usr/local/bin/python27
>>> /usr/local/lib/python2.7
>>> /usr/local/lib/libpython2.7.so
>>>
>>> Just because 'python2.7' exists under the lib directory doesn't mean the 
>>> Python installation as a whole was installed under the lib directory, only 
>>> part of it is.
>>>
>>> Now, if you have an existing Python 2.7 installation, why aren't you 
>>> using it?
>>>
>>> That you have multiple Python 2.7 installations is possible why 
>>> everything is getting confused.
>>>
>>> Graham
>>>
>>>
>>>
>>> On 10 March 2013 19:24, Steve Liang <[email protected]> wrote:
>>>
>>>> >>> import sys
>>>> >>> from pprint import pprint as p
>>>> >>> p(sys.path)
>>>> ['',
>>>>  '/usr/local/lib/anaconda/lib/python27.zip',
>>>>  '/usr/local/lib/anaconda/lib/python2.7',
>>>>  '/usr/local/lib/anaconda/lib/python2.7/plat-linux2',
>>>>  '/usr/local/lib/anaconda/lib/python2.7/lib-tk',
>>>>  '/usr/local/lib/anaconda/lib/python2.7/lib-old',
>>>>  '/usr/local/lib/anaconda/lib/python2.7/lib-dynload',
>>>>  '/usr/local/lib/anaconda/lib/python2.7/site-packages',
>>>>  '/usr/local/lib/anaconda/lib/python2.7/site-packages/PIL',
>>>>
>>>>  
>>>> '/usr/local/lib/anaconda/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
>>>>
>>>> Python 2.7.3 was installed in /usr/local/lib/, so anaconda was 
>>>> installed in /usr/local/lib/ as well. 
>>>>
>>>>
>>>> On Sunday, March 10, 2013 10:01:24 PM UTC-4, Graham Dumpleton wrote:
>>>>
>>>>> When you run the command line '/usr/local/lib/anaconda/bin/python' 
>>>>> and dump out sys.path, what do you get?
>>>>>
>>>>> Also, is there a specific reason you have installed the Python 
>>>>> installation under /usr/local/lib? This is a strange place to be putting 
>>>>> it, normally you would stick it under /usr/local, so you would have 
>>>>> /usr/local/anaconda/bin/python.
>>>>>
>>>>> Graham
>>>>>
>>>>>
>>>>> On 10 March 2013 18:53, Steve Liang <[email protected]> wrote:
>>>>>
>>>>>> Here is the anaconda directory. Not sure what is mod_wsgi looking for:
>>>>>>
>>>>>> [Fri Mar 08 21:01:42 2013] [info] mod_wsgi (pid=23091): Python home 
>>>>>> /usr/local/lib/anaconda.
>>>>>> [Fri Mar 08 21:01:42 2013] [info] mod_wsgi (pid=23091): Initializing 
>>>>>> Python.
>>>>>> Could not find platform independent libraries <prefix>
>>>>>> Could not find platform dependent libraries <exec_prefix>
>>>>>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>>>>> ImportError: No module named site
>>>>>>
>>>>>> ============
>>>>>> [root@ modules]# ls -al /usr/local/lib/anaconda/
>>>>>> drwxr-xr-x  2 root root  4096 Mar  7 15:44 bin
>>>>>> drwxr-xr-x  2 root root  4096 Feb 14 12:04 conda-meta
>>>>>> drwxr-xr-x  3 root root  4096 Feb 14 12:04 docs
>>>>>> drwxr-xr-x  2 root root  4096 Feb 14 12:04 envs
>>>>>> drwxr-xr-x  4 root root  4096 Feb 14 12:04 etc
>>>>>> drwxr-xr-x 38 root root  4096 Feb 14 12:04 include
>>>>>> drwxr-xr-x 13 root root 16384 Feb 14 12:04 lib
>>>>>> -rw-rw-r--  1 1012 1012  2480 Aug 18  2012 LICENSE.txt
>>>>>> drwxr-xr-x 93 root root  4096 Feb 14 12:04 pkgs
>>>>>> drwxr-xr-x  7 root root  4096 Feb 14 12:04 share
>>>>>> drwxr-xr-x  3 root root  4096 Feb 14 12:04 var
>>>>>>
>>>>>> ==========
>>>>>> This is /etc/httpd/conf/httpd.conf
>>>>>> WSGIPythonHome /usr/local/lib/anaconda
>>>>>> #WSGIPythonPath /usr/local/lib/anaconda/lib/python2.7/site-packages
>>>>>> WSGIScriptAlias /abc /var/www/wsgi-scripts/abc
>>>>>> WSGIVerboseDebugging On
>>>>>>
>>>>>> <Directory "/var/www/wsgi-scripts">
>>>>>>     Order allow,deny
>>>>>>     Allow from all
>>>>>> </Directory>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> When I switched back to the repository mod_wsgi (and uncomment 
>>>>>> WSGIPythonHome), I can run the test.wsgi (w/ printing sys.path)
>>>>>> [Sun Mar 10 21:35:12 2013] [warn] mod_wsgi: Compiled for Python/
>>>>>> 2.6.2.
>>>>>> [Sun Mar 10 21:35:12 2013] [warn] mod_wsgi: Runtime using Python/
>>>>>> 2.6.6.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4165): Initializing 
>>>>>> Python.
>>>>>> --- ---
>>>>>> [Sun Mar 10 21:35:12 2013] [notice] Apache/2.2.15 (Unix) DAV/2 
>>>>>> PHP/5.3.3 mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal 
>>>>>> operations
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4172): Initializing 
>>>>>> Python.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4166): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4167): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4165): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4168): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4169): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4170): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4171): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:12 2013] [info] mod_wsgi (pid=4172): Attach 
>>>>>> interpreter ''.
>>>>>> [Sun Mar 10 21:35:24 2013] [info] [client 172.21.109.153] Digest: 
>>>>>> user steve: nonce expired (188171.00 seconds old - max lifetime 300.00) 
>>>>>> - 
>>>>>> sending new nonce
>>>>>> [Sun Mar 10 21:35:42 2013] [info] mod_wsgi (pid=4171): Create 
>>>>>> interpreter 'server.xyz.com|/abc/test0.wsgi'.
>>>>>> [Sun Mar 10 21:35:42 2013] [debug] mod_wsgi.c(5111): mod_wsgi 
>>>>>> (pid=4171): Bind thread state for thread 0 against interpreter 
>>>>>> server.xyz.com|/abc/test0.wsgi'.
>>>>>> [Sun Mar 10 21:35:42 2013] [info] [client 172.21.109.153] mod_wsgi 
>>>>>> (pid=4171, process='', application=server.xyz.com|/abc/test0.wsgi'): 
>>>>>> Loading WSGI script '/var/www/wsgi-scripts/abc/test0.wsgi'.
>>>>>> [Sun Mar 10 21:35:42 2013] [error] sys.prefix = '/usr'
>>>>>> [Sun Mar 10 21:35:42 2013] [error] sys.path = 
>>>>>> ['/usr/lib64/python26.zip', '/usr/lib64/python2.6', 
>>>>>> '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', 
>>>>>> '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', 
>>>>>> '/usr/lib64/python2.6/site-packages', 
>>>>>> '/usr/lib64/python2.6/site-packages/gtk-2.0', 
>>>>>> '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-
>>>>>> packages/setuptools-0.6c11-py2.6.egg-info']
>>>>>> [Sun Mar 10 21:35:50 2013] [info] mod_wsgi (pid=4170): Destroying 
>>>>>> interpreters.
>>>>>> [Sun Mar 10 21:35:50 2013] [info] mod_wsgi (pid=4165): Destroying 
>>>>>> interpreters.
>>>>>> [Sun Mar 10 21:35:50 2013] [info] mod_wsgi (pid=4170): Cleanup 
>>>>>> interpreter ''.
>>>>>>
>>>>>>
>>>>>> Not sure what goes wrong here...
>>>>>>
>>>>>> Steve
>>>>>>
>>>>>>
>>>>>> On Friday, March 8, 2013 8:22:09 PM UTC-5, Graham Dumpleton wrote:
>>>>>>
>>>>>>> Sorry, missed that you had included it.
>>>>>>>
>>>>>>> Set Apache LogLevel:
>>>>>>>
>>>>>>> LogLevel debug
>>>>>>>
>>>>>>> and:
>>>>>>>
>>>>>>> WSGIVerboseDebugging On
>>>>>>>
>>>>>>> and see what debug messages in log for mod_wsgi say.
>>>>>>>
>>>>>>> Graham
>>>>>>>
>>>>>>>
>>>>>>> On 8 March 2013 17:11, Steve Liang <[email protected]> wrote:
>>>>>>>
>>>>>>>> [root@ modules]# ldd mod_wsgi.so
>>>>>>>>         linux-vdso.so.1 =>  (0x00007fff2b7ff000)
>>>>>>>>         libpython2.7.so.1.0 => 
>>>>>>>> /usr/local/lib/anaconda/lib/libpython2.7.so.1.0 
>>>>>>>> (0x00007f645d54e000)
>>>>>>>>         libpthread.so.0 => /lib64/libpthread.so.0 
>>>>>>>> (0x00007f645d317000)
>>>>>>>>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f645d113000)
>>>>>>>>         libutil.so.1 => /lib64/libutil.so.1 (0x00007f645cf10000)
>>>>>>>>         libm.so.6 => /usr/local/lib/anaconda/lib/libm.so.6 
>>>>>>>> (0x00007f645cc8c000)
>>>>>>>>         libc.so.6 => /lib64/libc.so.6 (0x00007f645c8f9000)
>>>>>>>>         /lib64/ld-linux-x86-64.so.2 (0x000000304d800000)
>>>>>>>>
>>>>>>>> On Friday, March 8, 2013 7:57:58 PM UTC-5, Graham Dumpleton wrote:
>>>>>>>>
>>>>>>>>> What do you get when you run:
>>>>>>>>>
>>>>>>>>> ldd mod_wsgi.so
>>>>>>>>>
>>>>>>>>> Graham
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 8 March 2013 16:49, Steve Liang <[email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Thanks Graham, I still get the same error.
>>>>>>>>>>
>>>>>>>>>> SELinux is disabled.
>>>>>>>>>> [root@ /]# sestatus
>>>>>>>>>> SELinux status:                 disabled
>>>>>>>>>>
>>>>>>>>>> user apache has access to /usr/local/lib/anaconda/
>>>>>>>>>> [root@ /]# sudo -u apache ls /usr/local/lib/anaconda/
>>>>>>>>>> bin  conda-meta  docs  envs  etc  include  lib  LICENSE.txt  pkgs 
>>>>>>>>>>  share  var
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Here are some output:
>>>>>>>>>> [user@ mod_wsgi-3.4]$ ./configure --with-python=/usr/local/lib/a
>>>>>>>>>> naconda/bin/python
>>>>>>>>>> checking for apxs2... no
>>>>>>>>>>  checking for apxs... /usr/sbin/apxs
>>>>>>>>>> checking Apache version... 2.2.15
>>>>>>>>>> configure: creating ./config.status
>>>>>>>>>> config.status: creating Makefile
>>>>>>>>>>
>>>>>>>>>> [user@ mod_wsgi-3.4]$ LD_RUN_PATH=/usr/local/lib/anaconda/lib 
>>>>>>>>>> make
>>>>>>>>>> /usr/sbin/apxs -c -I/usr/local/lib/anaconda/include/python2.7 
>>>>>>>>>> -DNDEBUG   mod_wsgi.c -L/usr/local/lib/anaconda/lib 
>>>>>>>>>> -L/usr/local/lib/anaconda/lib/python2.7/config  -lpython2.7 
>>>>>>>>>> -lpthread -ldl  -lutil -lm
>>>>>>>>>> /usr/lib64/apr-1/build/libtool --silent --mode=compile gcc 
>>>>>>>>>> -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
>>>>>>>>>> -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic 
>>>>>>>>>> -Wformat-security -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT 
>>>>>>>>>> -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   
>>>>>>>>>> -I/usr/include/apr-1  -I/usr/local/lib/anaconda/include/python2.7 
>>>>>>>>>> -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
>>>>>>>>>> ... ...
>>>>>>>>>>
>>>>>>>>>> [root@ mod_wsgi-3.4]# LD_RUN_PATH=/usr/local/lib/anaconda/lib 
>>>>>>>>>> make install
>>>>>>>>>> /usr/sbin/apxs -i -S LIBEXECDIR=/usr/lib64/httpd/modules -n 
>>>>>>>>>> 'mod_wsgi' mod_wsgi.la
>>>>>>>>>> /usr/lib64/httpd/build/instdso.sh 
>>>>>>>>>> SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' 
>>>>>>>>>> mod_wsgi.la /usr/lib64/httpd/modules
>>>>>>>>>> /usr/lib64/apr-1/build/libtool --mode=install cp mod_wsgi.la 
>>>>>>>>>> /usr/lib64/httpd/modules/
>>>>>>>>>> libtool: install: cp .libs/mod_wsgi.so 
>>>>>>>>>> /usr/lib64/httpd/modules/mod_wsgi.so
>>>>>>>>>> libtool: install: cp .libs/mod_wsgi.lai /usr/lib64/httpd/modules/
>>>>>>>>>> mod_wsgi.la
>>>>>>>>>> libtool: install: cp .libs/mod_wsgi.a 
>>>>>>>>>> /usr/lib64/httpd/modules/mod_wsgi.a
>>>>>>>>>> libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_wsgi.a
>>>>>>>>>> libtool: install: ranlib /usr/lib64/httpd/modules/mod_wsgi.a
>>>>>>>>>> libtool: finish: PATH="/usr/lib64/qt-3.3/bin:/u
>>>>>>>>>> sr/NX/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin::/root/bin:/sbin"
>>>>>>>>>>  
>>>>>>>>>> ldconfig -n /usr/lib64/httpd/modules
>>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>> ----------
>>>>>>>>>> Libraries have been installed in:
>>>>>>>>>>    /usr/lib64/httpd/modules
>>>>>>>>>>
>>>>>>>>>> Verifying the libraries:
>>>>>>>>>> [root@ modules]# ldd mod_wsgi.so
>>>>>>>>>>         linux-vdso.so.1 =>  (0x00007fff2b7ff000)
>>>>>>>>>>         libpython2.7.so.1.0 => 
>>>>>>>>>> /usr/local/lib/anaconda/lib/libpython2.7.so.1.0 
>>>>>>>>>> (0x00007f645d54e000)
>>>>>>>>>>         libpthread.so.0 => /lib64/libpthread.so.0 
>>>>>>>>>> (0x00007f645d317000)
>>>>>>>>>>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f645d113000)
>>>>>>>>>>         libutil.so.1 => /lib64/libutil.so.1 (0x00007f645cf10000)
>>>>>>>>>>         libm.so.6 => /usr/local/lib/anaconda/lib/libm.so.6 
>>>>>>>>>> (0x00007f645cc8c000)
>>>>>>>>>>         libc.so.6 => /lib64/libc.so.6 (0x00007f645c8f9000)
>>>>>>>>>>         /lib64/ld-linux-x86-64.so.2 (0x000000304d800000)
>>>>>>>>>>
>>>>>>>>>> The new mod_wsgi.so is about 426k, is it a reasonable size? The 
>>>>>>>>>> orginal one is about 150k.
>>>>>>>>>> [root@sacqtwe03 modules]# ls -al mod_wsgi*
>>>>>>>>>> -rwxr-xr-x 1 root root 426744 Mar  8 19:40 mod_wsgi.so
>>>>>>>>>> -rwxr-xr-x 1 root root 150888 Aug 22  2010 mod_wsgi.so.orig
>>>>>>>>>>
>>>>>>>>>> start apache (log level info):
>>>>>>>>>> [root@ modules]# service httpd start
>>>>>>>>>> Starting httpd:                                            [  OK 
>>>>>>>>>>  ]
>>>>>>>>>>
>>>>>>>>>> This is what's in the error_log:
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [notice] suEXEC mechanism enabled 
>>>>>>>>>> (wrapper: /usr/sbin/suexec)
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [notice] Digest: generating secret for 
>>>>>>>>>> digest authentication ...
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [notice] Digest: done
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] APR LDAP: Built with OpenLDAP 
>>>>>>>>>> LDAP SDK
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] LDAP: SSL support available
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17206): Python 
>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17206): 
>>>>>>>>>> Initializing Python.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17207): Python 
>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17207): 
>>>>>>>>>> Initializing Python.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17208): Python 
>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17208): 
>>>>>>>>>> Initializing Python.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17209): Python 
>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17209): 
>>>>>>>>>> Initializing Python.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17210): Python 
>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17210): 
>>>>>>>>>> Initializing Python.
>>>>>>>>>> Could not find platform independent libraries <prefix>
>>>>>>>>>> Could not find platform dependent libraries <exec_prefix>
>>>>>>>>>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>>>>>>>>> ImportError: No module named site
>>>>>>>>>> Could not find platform independent libraries <prefix>
>>>>>>>>>> Could not find platform dependent libraries <exec_prefix>
>>>>>>>>>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>>>>>>>>> ImportError: No module named site
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17211): Python 
>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>> [Fri Mar 08 19:44:46 2013] [info] mod_wsgi (pid=17211): 
>>>>>>>>>> Initializing Python.
>>>>>>>>>> Could not find platform independent libraries <prefix>
>>>>>>>>>> Could not find platform dependent libraries <exec_prefix>
>>>>>>>>>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>>>>>>>>> ImportError: No module named site
>>>>>>>>>> .... ....
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Friday, March 8, 2013 6:07:26 PM UTC-5, Graham Dumpleton wrote:
>>>>>>>>>>
>>>>>>>>>>> Don't link the .so into /usr/lib.
>>>>>>>>>>>
>>>>>>>>>>> Try instead when building mod_wsgi, doing:
>>>>>>>>>>>
>>>>>>>>>>> ./configure --with-python=/usr/local/lib/anaconda/bin/python
>>>>>>>>>>> LD_RUN_PATH=/usr/local/lib/anaconda/lib make
>>>>>>>>>>> LD_RUN_PATH=/usr/local/lib/anaconda/lib make install
>>>>>>>>>>>
>>>>>>>>>>> That will embed the library location in mod_wsgi.so so you don't 
>>>>>>>>>>> have to symlink it into system directories.
>>>>>>>>>>>
>>>>>>>>>>> Other than that, don't see any specific issues with what you 
>>>>>>>>>>> have done.
>>>>>>>>>>>
>>>>>>>>>>> Do make sure though that /usr/local/lib/anaconda is readable to 
>>>>>>>>>>> others so Apache user can see inside that directory.
>>>>>>>>>>>
>>>>>>>>>>> Ensure you aren't running some sort of security extensions such 
>>>>>>>>>>> as SELinux.
>>>>>>>>>>>
>>>>>>>>>>> Graham
>>>>>>>>>>>
>>>>>>>>>>> On 8 March 2013 14:15, Steve Liang <[email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> OS: CentOS 6
>>>>>>>>>>>> Apache: 2.2.15 from repository
>>>>>>>>>>>> Python: different versions installed
>>>>>>>>>>>>  - default: 2.6.6 from repository (/usr/bin)
>>>>>>>>>>>>  - also installed anaconda at /usr/lcoal/lib/anaconda
>>>>>>>>>>>>
>>>>>>>>>>>> mod_wsgi:
>>>>>>>>>>>>  - default 3.2.1 from "yum install mod_wsgi" (this works with 
>>>>>>>>>>>> the "hello world" test.wsgi)
>>>>>>>>>>>>
>>>>>>>>>>>> we want to use 2.7.3 python so we download mod_wsgi 3.4 and did 
>>>>>>>>>>>> the following based in the instructions:
>>>>>>>>>>>> - ./configure --with-python=/usr/local/lib/anaconda/bin/python
>>>>>>>>>>>> - make
>>>>>>>>>>>> - make install (install to /etc/httpd/modules)
>>>>>>>>>>>>
>>>>>>>>>>>> - ldd /etc/httpd/modules/mod_wsgi.so disp libpyhon2.7.so not 
>>>>>>>>>>>> found, so we did the following:
>>>>>>>>>>>> - ln -s /usr/local/lib/anaconda/lib/libpython2.7.so.1.0 
>>>>>>>>>>>> /lib64/libpython2.7.so.1.0
>>>>>>>>>>>>
>>>>>>>>>>>> - edit /etc/httpd/conf/httpd/conf to include the following:
>>>>>>>>>>>>
>>>>>>>>>>>> WSGIPythonHome /usr/local/lib/anaconda
>>>>>>>>>>>> #WSGIPythonPath /usr/local/lib/anaconda/lib/py
>>>>>>>>>>>> thon2.7/site-packages
>>>>>>>>>>>> WSGIScriptAlias /abc /var/www/wsgi-scripts/abc
>>>>>>>>>>>>
>>>>>>>>>>>> <Directory "/var/www/wsgi-scripts">
>>>>>>>>>>>>     Order allow,deny
>>>>>>>>>>>>     Allow from all
>>>>>>>>>>>> </Directory>
>>>>>>>>>>>>
>>>>>>>>>>>> But after httpd restart, we still get error: here is the error 
>>>>>>>>>>>> log:
>>>>>>>>>>>> [Fri Mar 08 16:44:24 2013] [notice] Apache/2.2.15 (Unix) DAV/2 
>>>>>>>>>>>> PHP/5.3.3 mod_wsgi/3.4 Python/2.7.3 configured -- resuming normal 
>>>>>>>>>>>> operations
>>>>>>>>>>>> [Fri Mar 08 16:44:24 2013] [info] Server built: Feb 13 2012 
>>>>>>>>>>>> 22:31:42
>>>>>>>>>>>> Could not find platform independent libraries <prefix>
>>>>>>>>>>>> Could not find platform dependent libraries <exec_prefix>
>>>>>>>>>>>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>>>>>>>>>>> ImportError: No module named site
>>>>>>>>>>>> [Fri Mar 08 16:44:24 2013] [info] mod_wsgi (pid=32538): Python 
>>>>>>>>>>>> home /usr/local/lib/anaconda.
>>>>>>>>>>>> [Fri Mar 08 16:44:24 2013] [info] mod_wsgi (pid=32538): 
>>>>>>>>>>>> Initializing Python.
>>>>>>>>>>>> Could not find platform independent libraries <prefix>
>>>>>>>>>>>> Could not find platform dependent libraries <exec_prefix>
>>>>>>>>>>>> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
>>>>>>>>>>>> ImportError: No module named site
>>>>>>>>>>>>
>>>>>>>>>>>> In fact, not only wsgi not working, httpd does not working 
>>>>>>>>>>>> properly, as our other webpages does not response. 
>>>>>>>>>>>>
>>>>>>>>>>>> Any suggestions?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> 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 [email protected].
>>>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>>>>
>>>>>>>>>>>> Visit this group at http://groups.google.com/group
>>>>>>>>>>>> /modwsgi?hl=en.
>>>>>>>>>>>> For more options, visit https://groups.google.com/grou
>>>>>>>>>>>> ps/opt_out.
>>>>>>>>>>>>  
>>>>>>>>>>>>  
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> 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 [email protected].
>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>>  
>>>>>>>>>>  
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> -- 
>>>>>>>> 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 [email protected].
>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>  
>>>>>>>>  
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> -- 
>>>>>> 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 [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>  
>>>>>>  
>>>>>>
>>>>>
>>>>>
>>>> -- 
>>>> 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 [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/modwsgi?hl=en.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>  
>>>>  
>>>>
>>>
>>>
> -- 
> 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 [email protected] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to