Archive for the ‘Apache’ Category
Installing Apache, PHP, MySQL, Postgresql on Mac OSX Leopard from source
Update: Updated post (on December 11, 2008) here.
Notes
- We won’t be running any binary installations, all software will be compiled from source.
- The installation won’t make use of Fink or Darwinports either.
- These are instructions for the Intel Macs.
- Using this approach would mean that you will need to maintain the stack by hand.
- Use this information at your own risk.
- 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:
- Xcode (from the Leopard DVD or Apple Developer connection )
- Readline (http://tiswww.case.edu/php/chet/readline/rltop.html)
- Tidy (http://tidy.sourceforge.net)
This installation would not have been possible without help from the following websites:
- Installing Readline on OSX without using Fink or Darwinports
- Workaround for Tidy’s platform.h problem
- 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 installUpdate: 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/binif 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!
Running Apache 2, PHP5 (Entropy) with Postgresql on Leopard
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:
- Download the respective packages from the website
- Install them according the instructions
- Stop the httpd that is shipped with leopard (sudo /usr/sbin/apachectl stop)
- Backup existing PHP module: cp /usr/local/apache2/modules/libphp5.so /usr/local/apache2/modules/libphp5.so.orig
- Replace with the Entropy version: sudo cp /usr/local/php5/libphp5.so /usr/local/apache2/modules/libphp5.so
- Backup existing php.ini: cp /private/etc/php.ini /private/etc/php.ini.orig
- Replace with the Entropy version: sudo cp /usr/local/php5/lib/php.ini /private/etc/php.ini
- Edit the httpd.conf in /usr/local/apache2/conf to load the PHP module
- Back up existing httpd.conf in /private/etc/httpd
- Replace it with the version in /etc/local/apache/conf
- Start Apache
- 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.
PHP on Windows tip
I have not seen much about this anywhere, but if you are wondering why you enabled extensions (in PHP.ini) don’t work in PHP on Windows, it is probably because your "extension_dir" path is wrong. This does not show up as an error anywhere other than in Apache’s error log, which is the last place where most would look for an error. To get rid of this error, do not use a relative path for the directory and use the absolute path. It is as simple as that.
Ibibo Pliggs it
Ibibo Labs has a link to one of their new products under testing, a Digg-clone running on Pligg, called Newscola. Strangely, for all of Nasper’s technology muscle, MIH had to use a freely available software to push the product out. Now, I don’t have any problems using open source or free software, but the mistake that most companies make is in rushing to the market just to launch the product, without any thought given to how it would integrate with their existing systems. Ibibo’s other services run on .Net and IIS, while Pligg is a LAMP product and there is no common login. I can forsee that at some point a poor developer will end up having to write hacks into Pligg’s authentication module to integrate the regular Ibibo login into the system or migrate the system wholesale to .Net, which is such a ridiculous waste of time.