PHP

Welcome to Fatalerror.in

So, the deed is finally done. I've moved finally from the Wordpress.com blog to my own digs. The weird thing is that I've been online for close to a decade and I have never owned a domain, nor been on any actual paid hosting setup of my own, so it is kind of weird that the first step I've taken in that direction is to be on a Virtual Private Server. Following is the stack that is powering this site: Web host: Slicehost (256 MB slice) Web server: Nginx0.6.29 Scripting language: PHP 5.2.5 (FCGI) Database Server: PostgreSQL 8.3 Object cache: Memcached CMS Framework: Drupal 6.2 Email: Google Apps for Domains It has taken me close to a month to get the set up tweaked, tuned and backed up to my liking and from the tests that I've done it should hold up well against reasonable traffic levels. If it were to go any higher than that, I'll slap on another slice to it and push the database on to that. It is a bit of a pain to hold a day job and also administer your own servers, but I love the freedom and flexibility it gives me. First impressions: Slicehost: Absolutely stunning service levels with zero problems. I have never pinged support for anything till date and almost everything is well documented. Can't say enough good things about them. The day they would allow me to save instances to deploy new slices based on them, I would be over the moon about it. Though I'll give you a fair warning, if you are not comfortable with the command line, stay clear of it.

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

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!

Syndicate content