Index syndication
comment syndication

Archive for webdev

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.

Tweet Wordpress plugin v1.2 released

Twitter Logo

I’ve uploaded the initial public release, v1.2, of my simple Tweet plugin to the Wordpress Plugin Repository. You can install the plugin by:

  • downloading it from http://wordpress.org/extend/plugins/tweet/ ; or
  • On a recent version of wordpress, v2.7 or above, follow these steps:
    1. Login to your wordpress dashboard
    2. Select the Plugins/Add New menu item as shown
      Step 1 installing the Tweet plugin
    3. Search for Author lantrix as shown
      Step 2 for installing Tweet plugin
    4. Click on the Install link for the Tweet plugin

If you need any assistance, you can leave a comment over on the dedicated page for the Tweet Wordpress plugin for Twitter.

If you like the plugin, I’m happy to accept donations if that’s your thing.

Wordpress 2.7 RC1 on iPhone

Now that I am using wordpress 2.7, I thought it would be good to test the iPhone app for wordpress. This is written on the app itself. I would say that although useful it seems to be more favorable to blog from a computer. The iPhone is suited to short spurts of typing, more on the realms of SMS or twitter.

The capability of quickly adding photos and the tag/category functionality seems full featured, as shown by a photo of my dinner I made from Cook with Jamie.

The app did crash when I tried to load this post from a local draft – it looks like the iPhone app needs a bit more work.

Blogging from the iPhone? 6 out of 10 points.

Wordpress 2.7 RC1

I’m lagging so far behind on wordpress that I’m probably breaking all the security rules.
So in an effort to be more proactive in online open-source communities I’m giving Wordpress V2.7 Release Candidate 1 a whirl. Looking forward to the new Admin UI.

Does anyone else ride the bleeding edge when it comes to tech blogging?

Edit: The upgrade worked. 2.7 RC1 even worked with all my 2.3 plugins straight up!

MySQL on OpenBSD 4.3 using the Apache Chroot

I’m back with some more tech geek goodness for anyone who uses MySQL and OpenBSD.

OpenBSD by default apache runs in a chroot jail, thereby making it more secure in case the www server is compromised. I have talked about this before.

However if you use wordpress or some other web application that needs MySQL (and I’m talking where apache and MySQL reside on the same host), then the chroot jail will not allow your webapp access to the mysql socket file which is by default located in /var/run/mysql/

There are various solutions available online to wait x number of seconds and then to create symlinks, etc – but this was not always working for me – with the result the server would sometimes be up without database availability.

Here is my solution (thanks to NoMoa for the idea) – very simple, no postfix symlink but there is a symlink to allow other applications to access MySQL locally via the default socket location.

First I create the run dirs in the apache jail:

mkdir -p /var/www/var/run/mysql
chown _mysql:_mysql /var/www/var/run/mysql
chmod 711 /var/www/var/run/mysql

Then I add this to the bottom of /etc/rc.local on the webhost.

#mySQL
if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/mysqld_safe ]; then
        echo -n " mysqld"; /usr/local/bin/mysqld_safe --user=_mysql --log --open-files-limit=256 --socket=/var/www/var/run/mysql/mysql.sock &
        if [ ! -L /var/run/mysql/mysql.sock ]; then
                mkdir -p /var/run/mysql
                chown _mysql:_mysql /var/run/mysql
                chmod 711 /var/run/mysql
                ln -fs /var/www/var/run/mysql/mysql.sock /var/run/mysql/mysql.sock
        fi
fi

Lastly I add this to my /etc/rc.conf.local

mysql=YES

Note: you may need to change the open-files-limit to suit, but the above paths are as per a standard OpenBSD 4.3 install using the supplied MySQL pkgs.

I tested this all out on OpenBSD 4.3 and it now works fine for me. Whenever the server comes up I never get the dreaded word press DB failure screen. Good luck

Next entries »