Index syndication
comment syndication

Archive for unix

PHP5 Zip Support on OpenBSD 4.5

This is a cheat sheet on getting PHP5 on OpenBSD to have zip support. I needed this to get CiviCRM to work with Joomla.

First off install some require packages, including the zziplib package:

export PKG_PATH=http://mirror.aarnet.edu.au/pub/OpenBSD/4.5/packages/i386/
pkg_add -v zziplib
pkg_add -v autoconf-2.62

Now download and extract the PECL zip package:

mkdir /usr/local/src/
cd /usr/local/src/
wget http://pecl.php.net/get/zip
tar zxvf zip
cd zip-1.10.2/

Compile PECL zip, making sure you set your correct autoconf to use:

export AUTOCONF_VERSION=2.62
phpize
./configure
make
make install

Finally setup php5 and restart httpd:

cat << EOF >> /var/www/conf/php.ini
extension=zip.so
EOF
sudo apachectl stop
sudo apachectl start

Of course, this will go stale over time as new releases and versions come out, so YMMV.

awk oneliner to find large files

A mega geeky awk one-liner today. Tested on Solaris under bash, so YMMV.

Have you ever found that a filesystem is filling up fast, and dont know what is causing it? This one liner (which can be placed in a cron job if you like) is best run as a super user.

It will:

  1. Search for all files in the current dir and subdirs that are modified in the last 3 days;
  2. list them, filtering just the filesize and name/path;
  3. sort/order by the largest file; and
  4. Email you a copy of the report.
 find / -type f -mtime -3 -exec ls -l {} \; 2>/dev/null \
| awk '{print $5 " " $9}' \
| awk '{printf "%12d\t%s\n", $1, substr($0,index($0,$2),80)}' \
| sort -r >/tmp/largefiles.txt && \
( uuencode /tmp/largefiles.txt largefiles.txt ) \
| mailx -s 'Large Files Report' -r mail2@youremail.com `cat /tmp/mailrecipients` &

Nice. If you just want to see the response on stdout then try this:

 find / -type f -mtime -3 -exec ls -l {} \; 2>/dev/null \
| awk '{print $5 " " $9}' \
| awk '{printf "%12d\t%s\n", $1, substr($0,index($0,$2),80)}' \
| sort -r

Have fun.

Compiling readline on an OSX 10.5 intel x86_64

I’m stuck with a whole bunch of problems getting code to compile and co-operate nicely on my new MacBookPro. I’m compiling my own PHP, but it defaults to compiling for the i386 (32bit) architecure, which then fails when Apache2 running in 64bit mode tries to use the 32bit DSO for PHP5. Compiling PHP5 as 64bit then fails linking against the i386 pgsql lib, and so on. I really need everything using the x86_64 architecture. How does this all relate to readline under Leopard?
Read the rest of this entry »

Using your MacBookPro to PXEBoot OpenBSD

This post does not show a successful outcome in case that’s what you where hoping for.

I was trying to get OpenBSD bootstrapped using the PXEBoot NIC in a server. I decided to use my Mac which has tftp and bootpd installed. This post is quite in depth and technical so if you are game then read on.
Read the rest of this entry »

« Previous entries · Next entries »