Blue Screen Of Duds

Where the alter ego of codelust plays

Archive for the ‘Mysql’ Category

Sun takes a leaf out of Apple’s book

with one comment

Okay, boo hoo, Sun and MySQL got married with Jonathan wearing the oddest of wedding dresses and doing the oddest of post-wedding kisses. This has not drawn the warmest of bear hugs from the PostgreSQL fans (okay, I am one, shoot me!), newly uncertain in the fear of the loss of PostgreSQL’s status as Sun’s preferred OSS RDBMS mistress, now that MySQL has become the preferred OSS RDBMS partner.

The story, I am afraid, is not as simple as that. This move by Sun is not something that can be seen in isolation — it is a just piece of larger pie that Sun is chasing after, which is to recreate the Apple experience on open source software that scales seamlessly from one end of the market (the proof of concept) to the other extreme (enterprise-grade technology).

What Sun wants you to do is to get you started on OpenSolaris when you are a one-man start up, backed by a well integrated stack (they already have helped out the RoR community regarding their scaling woes) and watch you grow till the day you need the beefy servers and storage that is required by any reasonably large online business.

In the picture they are trying to patch together, the code and the components involved will work through this upgrade path without much change, resulting in near-zero disruption or refactoring on the code base. Essentially, what they are aiming for is to reproduce the Apple mantra “It just works” in a segment where such a feature would bring in considerable savings.

But why MySQL? Well, for one it is a proper company. Big companies and their boards love to buy things (especially when they are shelling out a billion dollars) which are a bit prim and propah. Moreover, it also makes it easier for them to integrate both operations. But, more than anything else, Sun needed a widely-used database to finish the stack — something it could own — and you can’t talk about ‘owning’ PostgreSQL without having a good laugh even while you are speaking about it.

Moving on, this is a play that is not meant for the current year. This is something that will only play out some two years down the line and these are the reasons why:

  1. There is nothing that stops the average start up from using the average $300 a pop dedicated server to flag off their operations and move into the monster servers and server farms at a later stage. But anyone who has done it will tell you that it is a painful experience for which there really is no manual you can look up and replicate.
  2. Software, by itself, is hard to tune. It is easy to write your first PHP script and run your website, but PHP itself can be tuned in different ways. There is a fair bit of learning that is repeated here with almost every start up and that is time and effort (translating into additional costs) that can be saved when cash is pretty sparse. The same is the case with HTTP servers, databases and application servers.
  3. A lot of software tuning is highly dependent on hardware. And at high performance levels, even marginal differences on every instance you run can result in significant savings. Moving from a 32 bit architecture to 64 bit architecture can result in significant heartache (let us not start into the ‘lib’ mess that Linux distros can get you into when moving from 32 bit to 64 bit), which is okay when you run about a dozen servers, but as you get closer to the three digit figure this can be a traumatic experience you’d not want to wish on even the worst of your enemies.

Now, imagine a vendor who can accomplish the same for you (also known as a very controlled environment), where things just work. If Sun can guarantee a pain-free seamless upgrade path from an OpenSolaris platform to Solaris proper that will run on Sun’s more expensive rigs, they would have a winner on their hands. And that is the sweet spot Sun is aiming to be in two years.

Related: Give Me a M: The MySQL/Sun Q&A

Advertisements

Written by shyam

January 17, 2008 at 5:08 pm

Posted in Mysql, Opensource, Postgresql, Sun

Tagged with , ,

Installing Apache, PHP, MySQL, Postgresql on Mac OSX Leopard from source

with 14 comments

Update: Updated post (on December 11, 2008) here.

Notes

  1. We won’t be running any binary installations, all software will be compiled from source.
  2. The installation won’t make use of Fink or Darwinports either.
  3. These are instructions for the Intel Macs.
  4. Using this approach would mean that you will need to maintain the stack by hand.
  5. Use this information at your own risk.
  6. If you don’t want to go through all the trouble and use a binary installation, read this post.

The software stack we are going to install will be as follows:

Apache HTTP Server 2.2.6

Modules
core
mod_authn_file
mod_authn_dbm
mod_authn_default
mod_authz_host
mod_authz_groupfile
mod_authz_user
mod_authz_default
mod_auth_basic
mod_include
mod_filter
mod_log_config
mod_env
mod_setenvif
mod_ssl
prefork
http_core
mod_mime
mod_dav
mod_status
mod_autoindex
mod_asis
mod_info
mod_cgi
mod_dav_fs
mod_negotiation
mod_dir
mod_actions
mod_speling
mod_alias
mod_rewrite
mod_so
mod_php5

PHP 5.2.5

Modules
bz2
calendar
ctype
curl
date
dom
exif
filter
gd
hash
iconv
json
ldap
libxml
mbstring
mysql
mysqli
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
posix
session
SimpleXML
snmp
SPL
SQLite
standard
tidy
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib

MySQL 5.1.22 RC

Stock install

Postgresql 8.2.5

Stock install

We will also need to install the following software dependencies:

  1. Xcode (from the Leopard DVD or Apple Developer connection )
  2. Readline (http://tiswww.case.edu/php/chet/readline/rltop.html)
  3. Tidy (http://tidy.sourceforge.net)

This installation would not have been possible without help from the following websites:

  1. Installing Readline on OSX without using Fink or Darwinports
  2. Workaround for Tidy’s platform.h problem
  3. Installing the GD library on OSX Leopard

Now to the installation:

Install Xcode

Install MySQL

Download mysql-5.1.22-rc.tar.gz from the http://dev.mysql.com website
Uncompress
$/configure --prefix=/usr/local/mysql
$make
$sudo make install

Update: The steps did help me in getting to install the server, but on start up it did give certain location-specific errors.

As Hill has pointed out in the comments, MySQL.com has not released a version of their software for Leopard, but I got 5.1.22 RC to install, run and connect from PHP without any hassles following the instructions in one of the links he had kindly posted.

Install Readline

Download the source from ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
Uncompress
$./configure
There are bugs with the installation as elaborated in this link with workarounds:
$make static
$sudo make install static

Install Postgresql

Download the source from http://www.postgresql.org
Uncompress
$./configure --with-prefix=/usr/local/postgresql
$make
$sudo make install

Install GD

Follow the instructions at Veola.net

Install Tidy

Download Tidy source
Uncompress
$./configure
$make

This will throw up errors that can be fixed by following these instructions
$sudo make install

Install Apache

$CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
$./configure \
--prefix=/usr/local/apache2 \
--enable-authn-dbm \
--enable-ssl \
--enable-dav \
--enable-info \
--enable-speling \
--disable-userdir \
--enable-rewrite \
--enable-so \
--with-ssl=/usr/bin

if you get an apr.h error regarding sendfile, edit the apr.h file in srclib/ext/includes and change APR_HAS_SENDFILE to ‘0’

$make
$sudo make install

Install PHP

$./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--prefix=/usr/local/php \
--with-pgsql=/usr/local/postgresql \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-tidy=/usr \
--with-curl=/usr/bin \
--with-curlwrappers \
--with-openssl-dir=/usr/bin \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/X11R6 \
--with-zlib-dir=/usr \
--with-freetype-dir=/usr/X11R6 \
--enable-mbstring \
--with-xpm-dir=/usr/X11R6 \
--with-pdo-pgsql=/usr/local/postgresql \
--with-pdo-mysql=/usr/local/mysql \
--with-xsl=/usr/bin \
--with-ldap \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-snmp=/usr --enable-exif \
--enable-calendar \
--with-bz2=/usr \
--enable-debug

$make
$sudo make install

And that’s all folks!

Written by shyam

December 23, 2007 at 12:23 pm

Posted in Apache, Apple, Leopard, Mysql, OSX, PHP

Tagged with , , , , ,

Running Apache 2, PHP5 (Entropy) with Postgresql on Leopard

with 4 comments

Update: New post on installing from source here.

Getting Apache 2, PHP 5, MySQL 5 and Postgresql 8 on Leopard was not as easy as it was made to look, so I am noting it down so that it could help somebody later.

This does not deal with installing PHP or Apache from source which can be a bit hairy on OSX.

This was done on OSX Leopard, I have no idea if the same will work on Tiger, Panther etc.

Follow the instructions at your own risk. It did not blow up my Macbook Pro in doing this, but I can’t guarantee you that you’ll extract the same mileage.

All binaries have been downloaded from Marc Liyanage’s website (thanks Marc!):

Steps:

  1. Download the respective packages from the website
  2. Install them according the instructions
  3. Stop the httpd that is shipped with leopard (sudo /usr/sbin/apachectl stop)
  4. Backup existing PHP module: cp /usr/local/apache2/modules/libphp5.so /usr/local/apache2/modules/libphp5.so.orig
  5. Replace with the Entropy version: sudo cp /usr/local/php5/libphp5.so /usr/local/apache2/modules/libphp5.so
  6. Backup existing php.ini: cp /private/etc/php.ini /private/etc/php.ini.orig
  7. Replace with the Entropy version: sudo cp /usr/local/php5/lib/php.ini /private/etc/php.ini
  8. Edit the httpd.conf in /usr/local/apache2/conf to load the PHP module
  9. Back up existing httpd.conf in /private/etc/httpd
  10. Replace it with the version in /etc/local/apache/conf
  11. Start Apache
  12. Profit?

I know it is not the best or the most proper way possible. But after many days of poking around, this was the easiest and I am not one to complain about that.

Written by shyam

December 14, 2007 at 12:47 pm

Posted in Apache, Apple, Leopard, Mysql, OSX