Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created October 20, 2010 02:08
Show Gist options
  • Save lantrix/635627 to your computer and use it in GitHub Desktop.
Save lantrix/635627 to your computer and use it in GitHub Desktop.
#Mac OS X 10.x - PostgreSQL/PHP
##Install Mac OSX Developer tools##
##Backup old Postgresql##
pg_dumpall > ~/Documents/dumps/dumpfile
pg_ctl stop
##Compile Postgresql 8.3.14##
##Download readline "http://tiswww.case.edu/php/chet/readline/rltop.html#CurrentStatus"
export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
export CCFLAGS="-arch x86_64 -g -Os -pipe"
export CXXFLAGS="-arch x86_64 -g -Os -pipe"
export LDFLAGS="-arch x86_64 -bind_at_load"
cd /usr/local/src
tar zxvf readline-6.1.tar.gz
cd readline-6.1
./configure --prefix=/usr/local
make && sudo make install
##Compile PostgreSQL
cd /usr/local/src
tar zxvf postgresql-8.3.14.tar.gz
#./configure --bindir=/usr/local/bin --mandir=/usr/local/share/man --with-includes=/sw/include --with-libs=/sw/lib --with-openssl
./configure --with-libs=/usr/local/lib --bindir=/usr/local/bin --mandir=/usr/local/share/man --with-openssl
make && sudo make install
sudo chown -R postgres:postgres /usr/local/pgsql
sudo touch /var/log/postgresql.log
sudo chown postgres /var/log/postgresql.log
##Restore old dump
su - postgres
initdb -D /usr/local/pgsql/data
pg_ctl -D /usr/local/pgsql/data -l /var/log/postgresql.log start
psql -d postgres -f ~/Documents/dumps/dumpfile
##compile gettext
#./configure && make && sudo make install
#fink install freetype2 freetype2-dev libmcrypt libjpeg libpng3 libtiff gettext
#fink install libxml
#perl -MCPAN -e shell
#install XML::Parser
##compile expat-2.0.0.tar.gz
#./configure && make && sudo make install
##compile sablotron Sablot-1.0.3.tar.gz
#./configure --with-iconv --with-expat=/usr/local && make && sudo make install
##Install IMAP libs
##download imap.tar.Z from http://www.washington.edu/imap/mirrors.html
#tar -zxvf imap.tar.Z
#cd imap-2006c1/
#make oxp
#mkdir -p /usr/local/imap/lib /usr/local/imap/include
#cp c-client/*.h /usr/local/imap/include/
#cp c-client/*.c /usr/local/imap/lib/
#cp c-client/c-client.a /usr/local/imap/lib/libc-client.a
#ranlib /usr/local/imap/lib/libc-client.a
## If you want MySQL then just use MAMP
##compile PHP on 32 bit Mac CPU (i.e. CoreDuo)
#./configure --prefix=/usr --without-iconv --with-pgsql --with-apxs2 \
#--with-zlib-dir=/usr --with-gd --localstatedir=/var --mandir=/usr/share/man \
#--infodir=/usr/share/info --with-ldap=/usr --with-kerberos=/usr --enable-ftp \
#--with-jpeg-dir=/sw --with-png-dir=/sw --enable-mbstring --with-gettext=/sw \
#--with-xpm-dir=/usr/X11R6/ --with-openssl --enable-cli --enable-sockets \
#--with-iodbc=/usr --with-config-file-path=/etc --sysconfdir=/private/etc \
#--with-curl=/usr --enable-exif --with-mcrypt=/sw --with-freetype-dir=/sw/lib/freetype2 \
#--with-imap=/usr/local/imap --with-imap-ssl=/usr/include/openssl
##compile PHP on 64bit Intel CPU (i.e. Core2Duo, i5 or i7)
#./configure --with-apxs2 --without-iconv --with-pgsql
make && sudo make install
##install Pear MDB2
sudo pear channel-update pear.php.net
sudo pear install MDB2
sudo pear install --nodeps MDB2_Driver_pgsql
sudo pear upgrade-all
##Setup for Horde
pear config-set preferred_state beta
pear upgrade-all
fink -b install file file-dev file-shlibs
sudo ln -s /sw/include/magic.h /usr/include/
sudo ln -s /sw/lib/libmagic.* /usr/lib/
sudo pear install Auth_SASL MDB2 Mail Mail_Mime Log File Date Services_Weather Cache HTTP_Request SOAP XML_Serializer sqlite NET_URL memcache XML_Util mime_magic
sudo pecl install fileinfo json memcache
#This is how I FINALLY got fileinfo installed via pecl on a
#Powerbook, OSX 10.4.8. You need fink installed and working
#first for the magic libs:
fink -b install file file-dev file-shlibs
sudo ln -s /sw/include/magic.h /usr/include/
sudo ln -s /sw/lib/libmagic.* /usr/lib/
sudo pecl install fileinfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment