Wednesday, April 16, 2008

"libmysqlclient.so.14" not found, required by "php"

/libexec/ld-elf.so.1: Shared object "libmysqlclient.so.14" not found, required by "php"


Did you upgraded mysql recently? If so, be a man and recompile that php too. :)

IPs most accessing your Apache

Here's a command using which you can find out what IPs are accessing your http server Apache most from its log file.

cat log | grep "GET /" | awk '{print $1}' | sort | uniq -c | sort -rn | less


It is useful in a case of DDoS attack, when you want to know these IPs and ban them in your firewall.

Tuesday, April 8, 2008

nmbclusters

Today I had to compile a new FreeBSD kernel for a fresh installed machine. I looked up my trusty (and pretty old) kernel config file, and, being a real man I am, didn't looked at any NOTES, LINT and other girly stuff, and proceeded to config. So, much to my surprise, I received an error:

unknown option NMBCLUSTERS

Fast glance into FreeBSD manual revealed, that

"kern.ipc.nmbclusters loader tunable should be used to tune this at boot time. Only older versions of FreeBSD will require you to use the NMBCLUSTERS kernel config(8) option."

Oh well. :)

http://www.freebsd.org/doc/en/books/handbook/configtuning-kernel-limits.html

Tuesday, April 1, 2008

First FreeBSD 7.0 install

Today, I got my first 7.0 FreeBSD server to install. Everything went normal, only one quirk while installing linuxthreads, but managed to do without them.

Zend Optimizer 3.3.0a, though, greeted me with
/libexec/ld-elf.so.1: Shared object "libm.so.4" not found, required by "php"

So, the solution was to
cd /usr/ports/misc/compat6x
make install clean

Wednesday, March 26, 2008

mod_rewrite cheat sheet

Found this while searching for RewriteRule flags explanation. It's great.

http://www.ilovejackdaniels.com/cheat-sheets/mod_rewrite-cheat-sheet/



On a side note, I still couldn't disable the rewriting for one particular directory, and still haven't found, why. Oh well, just disabled it for .gif files and it's apparently working, so who cares.

Tuesday, March 25, 2008

Excluding directories from rsync backup

The thing is, some a**hole clients of hours don't mind keeping a lot of useless data on their servers. Basically I don't mind either, but this one time I had to discover, that because of this, the backup server ran out of space on one of its HDDs.

So I set to investigate the options, and the useful thing I discovered was how to exclude directories in rsyncd.conf.

Here's an example.

[hosts]
path = /home/hosts
comment = serv1
hosts allow = x.x.x.x
exclude = www.domain1.com/ www.domain2.com/


This will exclude directories named domain1.com and domain2.com. More on the syntax of the exclude command can be found at

http://www.ss64.com/bash/rsync.html

Monday, January 21, 2008

Dealing with ports

Recently I came across of a more "posh", if you will, way to deal with ports. Instead of trusty old cvsup I was recommended to try out portsnap, which cames in FreeBSD base system for a while already - specifically, since 6.0. Older than that, just use ports-mgmt/portsnap port.

It is very easy to use - in fact, I find it easier than cvsupdate.

First, you need to fetch a compressed snapshot of the ports tree.
# portsnap fetch

Next, a live copy of ports tree should be extracted in /usr/ports - the manual mentions you should do this regardless even if there is one created with cvsup.
# portsnap extract

That was for the first time. After that, it's just update
# portsnap fetch update


Next thing I found very handy was http://www.freshports.org/ports-mgmt/portupgrade/. Now unlike the vanilla cd /usr/ports/portdir && make install clean, it can actually update dependencies as well. Nice. Comes with a set of handy utilities - portinstall, pkg_deinstall etc.