Adding mod_deflate to Apache as a shared object

So you want to add mod_deflate to Apache but without recompiling it. You can compile just that module and add it dynamically.

What we need to do is create mod_deflate.so where the .so stands for shared object.

First find where apxs and apr-config are located. For me it was in /usr/local/apache/bin

Edit the apr-config file and change this line:

LDFLAGS=""

to this one:

LDFLAGS="-lz"

Then go to your Apache source files (or download them off of apache.org). Go to modules/filters and find the mod_deflate.c file.

Run this:

apxs -c mod_deflate.c

You should now have these files:

mod_deflate.c
mod_deflate.dsp
mod_deflate.exp
mod_deflate.la
mod_deflate.lo
mod_deflate.o
mod_deflate.slo

Notice there is no mod_deflate.so file there. This is where I got stuck. Fortunately on Apache’s site they indicate to do this:

apxs -i -a -n deflate mod_deflate.la

That creates the mod_deflate.so file, puts it in the modules folder, and adds this to your httpd.conf:

LoadModule deflate_module modules/mod_deflate.so

There you go.

Reddit it | Digg this | Stumble It | add to del.icio.us

Installing PDFlib Lite on Linux

I had some trouble, maybe if someone else has the same trouble I can help.

1. I downloaded the source code at the pdflib site

2. I unpacked it and ran the configure and make commands and such. So far so good.

3. I realized that unlike the full version, this doesn’t come with the php extension bindings.

4. Tried to use pear install pdflib like the instructions said, but that failed, so I tried pecl, but it claimed my gcc didn’t work:

# pear install pdflib
No releases available for package “pear.php.net/pdflib” – package pecl/pdflib can be installed with “pecl install pdflib”
Cannot initialize ‘pdflib’, invalid or missing package file
Package “pdflib” is not valid
install failed
# pecl install pdflib
downloading pdflib-2.1.5.tgz …
Starting to download pdflib-2.1.5.tgz (55,579 bytes)
………….done: 55,579 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
1. path to pdflib installation? :

1-1, ‘all’, ‘abort’, or Enter to continue: 1
path to pdflib installation? [] : /usr/local
1. path to pdflib installation? : /usr/local

1-1, ‘all’, ‘abort’, or Enter to continue:
building in /var/tmp/pear-build-root/pdflib-2.1.5
running: /root/tmp/pear/pdflib/configure –with-pdflib=/usr/local
checking for egrep… grep -E
checking for a sed that does not truncate output… /bin/sed
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… configure: error: cannot run C compiled programs.
If you meant to cross compile, use `–host’.
See `config.log’ for more details.
ERROR: `/root/tmp/pear/pdflib/configure –with-pdflib=/usr/local’ failed
#

So that failed. I don’t know why, because my gcc does work. Anyway, the solution was to start the pecl process, then open another terminal window and copy the /root/tmp/pear/pdflib/ files to another directory.

Then manually run configure –with-pdflib=/usr/local there.

(I also ran into trouble because I wasn’t giving /usr/local as the directory. I was giving /usr/local/lib which was where libpdf.so was. Trouble was, it needed pdflib.h which was in /usr/local/include. So giving /usr/local it knows to look both places. The error code I was getting was: configure: error: pdflib.h not found! Check the path passed to –with-pdflib=. PATH should be the install prefix directory.)

Then run make, then make test, then make install, and you’re done! You should now have pdf.so in your php extension directory, which is extension_dir in your php.ini file.

Hope that helps anyone googling for a solution based on error codes they’ve gotten.

Reddit it | Digg this | Stumble It | add to del.icio.us

So you installed the wrong heater, thermostat, wiring… all is not lost.

I grew up in a house with no insulation and only one source of heat, which didn’t make it to most parts of the house.

When remodeling the house, I tore out the bedroom down to the dirt under the house. I propped up the roof, and removed the floor and walls, fixed the foundation, and then rebuilt it all.

I insulated it well, and then put in a small gas furnace. Gas is cheaper than electricity, I reckoned, and it definitely needs a heat source, so with effort I ran a new gas line and hooked it all up.

The pilot light alone warms the room.

Usually too much. So the furnace is unused, and an electric oil-filled space heater heats the room. What a waste.

So when building my daughter’s nursery, I opted to put in an electric heater instead, since it has off mode that’s actually off…

I roughed in the can and ran 240v wiring to it, and 24v wiring from there to another wall where I wanted the thermostat to live.

Then all the finish work was done, the drywall and the painting, and it was time to install the heater itself.

And I discovered I’d installed a line voltage heater, which needs a line voltage thermostat. And instead I had a low voltage thermostat. 24 instead of 240. Only off by a factor of 10.

Worse than having the wrong thermostat is the fact that the wiring is already done and inside the walls and there is not 240 volt electrical cable leading from the thermostat to the heater.

I googled around for a solution, and found this transformer/relay (Model RC840T-240) to connect the two.

But at first I didn’t see how it would work. A light switch has the black “hot” supply wire come in, and another one leave and go to the light, right? And the switch determines if the current stops at the switch, or continues on to the light fixture.

Well I figured the relay would work the same way… two 120 volt supply wires, a black and a red, leave the circuit box and go to the relay, and then two 120 volt wires leave the relay and go to the heater. The thermostat is also hooked up to the relay and that is basically the switch. Right?

Except the wiring diagram showed the relay had three wires, a black, red, and blue. Just three. Not four. Shouldn’t it have a black/red pair for the incoming power and a blue/something pair for the outgoing power? The way it looked, one of the supply wires still went straight to the heater.

I was confused because the heater’s manual indicated that you should use 120 volt power with a 240 volt heater; that it wouldn’t run at full power that way.

So I figured if one 120 volt wire went straight to the heater, it would always be on, but at half power, right?

By the way I e-mailed these Aube people that make the relay, and they never answered. I also e-mailed the makers of the heater, but they said it would probably work but I sure really just buy a line voltage thermostat from them instead (ignoring that it would be a hardship to rewire the finished room) and didn’t answer my question about why the relay only had three wires.

Well, I finally figured out that a 240 volt heater needing two supply wires simply won’t work at all with only one. It doesn’t run at lower power. It doesn’t run at all. The warning against using 120 volt power on a 240 volt heater is probably for some yabo that would twist both heater wires together to avoid running two wires or something.

So the relay works great, and the wiring diagram makes perfect sense given my newfound knowledge. I had to break the wiring in the attic crawlspace (which I was going to have to do no matter what, since I made the initial mistake). I put in a nice box with the relay attached and was able to use all the wiring I had put in.

My daughter’s room has heat with a programmable thermostat! I wish I had had that, growing up.

Anyway, in case any other idiot out there doesn’t realize some of these things I learned the hard way, and googles for help, perhaps this page will come up.

Reddit it | Digg this | Stumble It | add to del.icio.us