Monday, November 30, 2015
linux administration - tips, notes and projects
I recently recompiled PHP on a server I own to upgrade it to the latest version. This particular server runs cPanel, which usually makes this otherwise tedious process much simpler. However, when recompiling mod_python it errors out with this message:
touch connobject.slo connobject.c: In function '_conn_read':
connobject.c:142: error: request for member 'next' in something not a structure or union
apxs:Error: Command failed with rc=65536
make: *** [mod_python.so] Error 1
The entire process then fails and reverts itself to the last known working LAMP stack.
The problem is actually a known bug, and is fixable with a bit of hackery. If you are not using a cPanel server, it’s very easy. Just simple change one line at your leisure prior to compiling.
If you are using a cPanel server, you need to time the patch correctly. Let me elaborate.
First, the bug itself is in connobject.c on line 142.
To fix, simply replace:
!(b == APR_BRIGADE_SENTINEL(b) ||
!(b == APR_BRIGADE_SENTINEL(bb) ||
Now, back to cPanel. Since easy apache will download fresh copies of the source upon each build session, you need to apply the fix strategically AFTER it downloads the fresh copy, but BEFORE it attempts to compile it. There is a window of approximately 1-2 minutes to do this, depending on the speed of your server.
Here’s a trick that I used to make sure I’m catching it.
First before starting the build, remove the file entirely
# rm -f /home/cpeasyapache/src/mod_python-3.3.1/src/connobject.c
Second, start the build process.
Now, do a simple while loop or just manually check for the file periodically. Once it appears, you know you’re working with the fresh copy from the build and can perform your edit on line 142.
# while true ; do ls /home/cpeasyapache/src/mod_python-3.3.1/src/connobject.c ; sleep 5; done
Once you’ve edited the buggy line, save the file, sit back and wait for the build to complete (successfully).
Hope this helped!
Bug reported at:
Leave a Reply