MySQL binary log rotation

Posted on January 18, 2007 on 1:56 pm by glen | In General, MySQL, RedHat | No Comments

We are running a MySQL replication setup, and find that the binary logs get very large, very quickly. Since MySQL didn’t come with a log rotation script, we rolled our own. Usage is simple:

At the top of the script are some definitions that you need to change for your setup:

  1. MYSQL_USER MYSQL_PASS - You will need to create a user in MySQL that has the RELOAD and SUPER privileges
  2. MYSQL_HOST - Where your MySQL server is located
  3. MYSQL_LOG_PATH MYSQL_LOG_NAME - where your binary logs are kept, and what they are called
  4. MYSQL_SLOW_LOG_NAME - the name of your slow log file
  5. MAX_LOG_DAYS - the number of days worth of old logs that you want to keep
  6. Once you’ve configured these values, whack the script into cron and run it daily.

    Download the script (1.6Kb)

Enabling GD library for PHP 4.4.4 on Mac OS X

Posted on December 16, 2006 on 2:21 am by glen | In MySQL, PHP, Apache, Mac | 4 Comments

For some reason, GD is not enabled in the default Mac OS X build of PHP 4.4.4. Here’s an easy way to install. Make sure you have the following fink packages installed:

  • libpng3
  • libjpeg

1. Download the source code for PHP 4.4.4

PHP 4.4.4 source

2. Unpack the source

tar jxvf php-4.4.4.tar.bz2
cd php-4.4.4

3. Compile and install the GD extension


cd ext/gd
phpize
./configure --with-jpeg-dir=/sw --with-png-dir=/sw --with-zlib-dir=/usr
make
sudo make install

This last stage will install the GD shared object into /usr/lib/php/extensions/no-debug-non-zts-20020429/

4. Pull in the GD module at startup

Edit /etc/php.ini and add the following line:

; Enable gd extension module
extension=gd.so

and make sure the following line is commented out:

;extension_dir = "./"

5. Restart Apache

sudo apachectl graceful

Bingo!

GD info

Feeds: Entries | Comments