Closed GoogleCodeExporter closed 9 years ago
Of if you do not have python26 installed this will not work. If your a CentOS
user you can add http://fedoraproject.org/wiki/EPEL to your yum repos and run
"yum install python26-devel"
Original comment by challgren
on 18 Nov 2010 at 12:06
You shoudl post this on cPanel developer forums as well:
http://forums.cpanel.net/developer-discussions.html
Original comment by annihili...@gmail.com
on 18 Nov 2010 at 5:44
Yep its at http://forums.cpanel.net/f5/mod_wsgi-easyapache-module-173501.html
but the file is attached here.
Original comment by challgren
on 18 Nov 2010 at 5:59
Greetings,
One of our EasyApache developers recommended that instead of leaving a note
that the module is not enabled for Apache 1.x, it should be made a "skip mod."
Here's the diff he sent me:
if ( $easy->get_ns_value_from_profile('Cpanel::Easy::Apache::1', $profile_hr) eq '1' ) {
- $self_hr->{'note'} = 'mod_wsgi is not enabled for Apache 1.X.
You should really consider upgrading to Apache 2.x';
+ $self_hr->{'skip'} = 1;
}
If you have any questions, let me know.
- David Grega
Technical Product Specialist, cPanel
Original comment by cPanelDa...@gmail.com
on 22 Nov 2010 at 7:35
To clarify,
Setting skip to 1 means this module is always skipped when someone tries to
compile this module into Apache 1.x. That way this opt mod won't erroneously
kill the entire build.
Original comment by cPanelDa...@gmail.com
on 22 Nov 2010 at 9:14
Thanks, yeah this was my first ever build for EasyApache so I'm learning.
Attached is the newer build that skips on Apache 1.x
Original comment by challgren
on 27 Nov 2010 at 12:41
Attachments:
Challgren, this looks like nice work, thanks. However, I'm not clear on some
things, maybe you (or someone else) can explain them to me. First, you mention
that Python 2.6 (devel) needs to be installed - but one of the big problems
I've been having with CentOS (from HostGator), is that they use Python 2.4 as
the main install for everything, and I'm not supposed to break that :)
Question 1: How do you have Python 2.6 installed on your system?
Question 2: Is it possible to modify your ModWSGI.pm script to skip
compilation, and just install my mod_wsgi.so module?
Question 3: Is this .pm file format documented anywhere?
I actually am using virtualenv to maintain a stand-alone environment for using
2.6 with various other packages - but as far as I can tell, if I ran your
install script, it would use the *system default* Python, 2.4
I actually compiled mod_wsgi.so for Python 2.6, then discovered that just
putting the module into EasyApache's custom_mods directory doesn't actually
*do* anything :(
Thanks for any help.
John C>
Original comment by cyclops@speakeasy.net
on 27 May 2011 at 3:03
I've been meaning to try this for a while and finally had a new server to test
on. Unfortunately, I did not see any mention of mod_wsgi in the easy_apache
setup screens (not sure whether I was supposed to). easy_apache ran to
completion, but there was no mod_wsgi.so in my modules directory, and grepping
the easy_apache log for mod_wsgi turned up nothing. It seems not to have seen
the module at all.
I've got python2.7 installed in /usr/local/bin - not sure whether that could be
related. Any more hints or documentation you can offer? Would really like to
get this going. Thanks.
Original comment by shacker....@gmail.com
on 11 Aug 2011 at 12:36
The option to enable WSGI is in Step 5 under Short Options List. I've attached
a screen shot for easy reference
Original comment by challgren
on 11 Aug 2011 at 12:46
Attachments:
Hmm, nope - it's definitely not present for me in step 5. Fiddling... OK I see
- the instructions above say
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf ModWSGI.tar.gz
so I had grabbed the ModWSGI.tar.gz out of the download and put in place. The
instruction should say:
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf
custom_opt_mod-mod_wsgi.tar.gz
which is the full package. It does show up in easy_apache now, great.
Unfortunately, the compilation failed with the following error. Any ideas?
Thanks.
-- Begin opt 'Mod WSGI (Custom Opt Mod)' --
-- Begin step 'Configuring mod_wsgi' --
checking Apache version... 2.2.19
checking for python... /usr/local/bin/python
configure: creating ./config.status
config.status: creating Makefile
-- End step 'Configuring mod_wsgi' --
-- Begin step 'Making mod_wsgi' --
/usr/local/apache/bin/apxs -c -I/usr/local/include/python2.7 -DNDEBUG
-Wc,-fPIC mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python2.7/config
-lpython2.7 -lpthread -ldl -lutil -lm
/usr/local/apache/build/libtool --silent --mode=compile gcc -prefer-pic -m64
-fPIC -DPIC -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -m64 -fPIC -DPIC -pthread
-I/opt/pcre/include -I/usr/local/apache/include -I/usr/local/apache/include
-I/usr/local/apache/include -fPIC -I/usr/local/include/python2.7 -DNDEBUG -c
-o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/local/apache/build/libtool --silent --mode=link gcc -o mod_wsgi.la -rpath
/usr/local/apache/modules -module -avoid-version mod_wsgi.lo
-L/usr/local/lib -L/usr/local/lib/python2.7/config -lpython2.7 -lpthread -ldl
-lutil -lm
/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32
against `a local symbol' can not be used when making a shared object; recompile
with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
!! 'make' failed with exit code '512' !!
!! Restoring original working apache !!
Original comment by shacker....@gmail.com
on 11 Aug 2011 at 1:03
Ahh sorry about that I forgot I renamed the file. Looks from the build output
its something with Python 2.7, I've only tested and been able to compile
successfully with Python 2.6. Sorry I haven't really had the time to test or
play around with Python 2.7
Original comment by challgren
on 11 Aug 2011 at 1:09
I'll try some experiments. Just tried recompiling python with the -fPIC flag
based on some forum talk elsewhere, but that didn't fix it unfortunately. Will
update if I figure it out.
Original comment by shacker....@gmail.com
on 11 Aug 2011 at 1:25
You mean rebuild Python with --enable-shared rather that -fPIC don't you. You
can't just force Python directly to use -fPIC but need the option to configure.
See:
http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bi
t_Packages
Original comment by Graham.Dumpleton@gmail.com
on 11 Aug 2011 at 2:28
Ah - OK, recompiled Python with --enable-shared and that gave me a set of libs
in /usr/local/lib. Per suggestions on the wiki, have tried moving those to
/lib, /usr/lib, and /usr/local/apache/lib (which is where cPanel systems keep
their shared libs, as far as I can tell). In each case, easy_apache fails with
the dreaded "/usr/local/bin/python: error while loading shared libraries:
libpython2.7.so.1.0: cannot open shared object file: No such file or directory"
Not sure where else I can try putting the libs to get easy_apache to find them.
Thoughts? Thanks much.
Original comment by shacker....@gmail.com
on 11 Aug 2011 at 7:24
Success! Used the ld.so configuration file trick suggested on the wiki page and
it worked - apache was able to find the python shared libs during compile. I've
written up a blog post explaining the whole process - hopefully someone will
find it useful in the future:
http://birdhouse.org/blog/2011/08/11/building-mod_wsgi-through-easyapache-for-wh
mcpanel-systems/
Thanks much chall and Graham Dumpleton!
Original comment by shacker....@gmail.com
on 11 Aug 2011 at 8:18
I actually go by challgren but google likes to munge my name
Original comment by challgren
on 11 Aug 2011 at 8:24
Fixed your name :) Thanks again for this excellent module.
Original comment by shacker....@gmail.com
on 11 Aug 2011 at 8:27
No problem, I've also written a subversion module for Easy Apache
Original comment by challgren
on 11 Aug 2011 at 8:28
Instead of put libpython2.7.so in system lib directories or usind ld.so, you
could have done:
LD_RUN_PATH=/usr/local/lib make
when building mod_wsgi and it would have embedded /usr/local/lib as place to
look in mod_wsgi.so file itself.
Original comment by Graham.Dumpleton@gmail.com
on 11 Aug 2011 at 11:12
'challgren', where can we download that subversion module for Easy Apache?
Original comment by i...@webhs.pt
on 31 Aug 2011 at 11:14
your mod_wsgi works with python 2.4.3?
Original comment by i...@webhs.pt
on 31 Aug 2011 at 11:18
Thanks for this. Seems to have worked for me.
Original comment by Erik.E.E...@gmail.com
on 19 Mar 2012 at 12:27
I'll see what I can do about putting out a subversion release
Original comment by challgren
on 26 Apr 2012 at 8:53
This was a most excellent help. Took it from probably taking a couple hours to
about 20 minutes for me to get my Mozilla Sync setup.
Original comment by wired...@gmail.com
on 31 Jul 2012 at 9:23
I changed the files for use with last actual version of mod_wsgi (3.4) ;)
Original comment by ralsalam...@gmail.com
on 6 Oct 2012 at 11:28
Attachments:
Thank you! Sadly my need for WSGI has disappeared so I won't be updating it
often.
Original comment by challgren
on 6 Oct 2012 at 11:32
I just ran into something weird - after an easy_apache mod_wsgi rebuild, Djano
sites could no longer find MySQLdb. I replaced the newly built mod_wsgi with
one from a backup, and it worked. But I didn't think mod_wsgi had any awareness
of mysql libs at all. Any theories about what might be going on here?
Original comment by scotfhac...@gmail.com
on 25 Feb 2013 at 8:44
mod_wsgi would have been compiled for a specific Python version. You sure the
new one isn't using a different Python version which doesn't have MySQLdb
client module installed.
Original comment by Graham.Dumpleton@gmail.com
on 25 Feb 2013 at 10:42
Graham, that turns out to be exactly what happened, but we can't figure out
why. The easy_apache module has compiled against the correct python version for
a couple of years now, and all of a sudden stopped. According to the post I
wrote about this back then
(http://birdhouse.org/blog/2011/08/11/building-mod_wsgi-easyapache-for-whmcpanel
/), easy_apache will find the correct path to python via:
/etc/ld.so.conf.d/python27.conf, which contains
/usr/local/lib/libpython2.7.so
and that .so does exist. So the question is, what changed? It's as if
WHM/cPanel no longer looks at that conf to figure out which python path to use
when compiling.
Thanks for any suggestions.
Original comment by scotfhac...@gmail.com
on 26 Feb 2013 at 7:06
Does this still require python 2.7 or can it be done on 2.4.3? My host gave me
a vps template with CentOS 5 that still has Python 2.4.3 and I'd like to try
this.
Original comment by halfpast...@gmail.com
on 28 Feb 2013 at 11:23
halfpast, I can't say for sure whether it will work with 2.4, but I wouldn't
recommend it. Instead, use my instructions above to install 2.7 in a separate
location (I'm guessing you're on a cPanel host, and cPanel annoyingly uses
python 2.4 internally in several places. So you don't want 2.4 for your general
wsgi work, but you also can't remove it without breaking things.
My larger concern is that this easy_apache module no longer seems to compile
against the separately-installed 2.7 version like it used to (see my comment
just above). Something seems to have changed in cPanel that affects where it
finds the python version to use during module compilation.
Original comment by scotfhac...@gmail.com
on 2 Mar 2013 at 4:39
[deleted comment]
It compiled on two servers with Python 2.4.3 out of the box
rpm -qa python*
python-sqlite-1.1.7-1.2.1
python-ldap-2.2.0-2.1
python-docs-2.4.3-1.1
python-iniparse-0.2.3-6.el5
python-urlgrabber-3.1.0-6.el5
python-2.4.3-56.el5
python-libs-2.4.3-56.el5
python-elementtree-1.2.6-5
python-devel-2.4.3-56.el5
python-numeric-23.7-2.2.2.el5_6.1
python-tools-2.4.3-56.el5
Original comment by nanocaio...@gmail.com
on 14 Apr 2013 at 1:08
Hi All,
I also had the same issue with the mod_wsgi EasyApache module now picking up
the wrong version of python on a rebuild, I have a solution!
Edit /var/cpanel/easy/apache/custom_opt_mods/Cpanel/Easy/ModWSGI.pm
Modify the configure command on line 26 to add the following argument:
--with-python=/usr/local/bin/python
so it is now:
qw(./configure --with-apxs=/usr/local/apache/bin/apxs
--with-python=/usr/local/bin/python)
This forces the module to use the python at /usr/local/bin/python rather than
/usr/bin/python.
I hope this helps! I rebuilt my WHM server only to find mod_wsgi was now
compiled with the wrong version, and now it all works fine after this fix, I
feel your pain!
Cheers,
James.
Original comment by jamesac...@gmail.com
on 30 Oct 2013 at 8:06
This isn't something I will ever be in position to support myself. Closing as
task to be done.
Original comment by Graham.Dumpleton@gmail.com
on 12 Nov 2014 at 10:23
Original issue reported on code.google.com by
challgren
on 17 Nov 2010 at 11:25Attachments: