Cài đặt Apache, PHP, MySQL, Postgresql trên Mac OSX Leopard từ source
Chào các bạn, hôm nay, sau một chuỗi ngày bận rộn… Khoa tôi quay lại và tiếp tục viết bài trên với blog của mình về cách cài đặt Apache, PHP, MySQL, Postgresql trên Mac OSX Leopard từ source. Các lưu ý xin bạn nhớ đến trước khi bắt đầu:
- Chúng ta sẽ không chạy các chương trình cài đặt nhị phân (binary) ở Tutorial này. Tất cả các ứng dụng trên sẽ được chạy ở dạng biên dịch (compile).
- Cài đặt sẽ không dùng Fink hay Darwinports.
- Bài hướng dẫn này là dành cho những người dùng chip Intel & Mac user.
- Đọc kỹ từng bước của Khoa tôi ở Tutorial này cẩn thận.
- Nếu bạn không thích cách biên dịch và muốn cài chúng ở dạng nhị phân thì Khoa tôi sẽ sớm có bài viết cho nó.
Nào, bây giờ chúng ta hãy xem những package, module sẽ có sau khi biên dịch:
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
Postgresql 8.2.5
Ngoài ra, chúng ta cũng cần cài các software sau:
- Xcode (từ Leopard DVD hoặc Apple Developer connection)
- Readline (http://tiswww.case.edu/php/chet/readline/rltop.html)
- Tidy (http://tidy.sourceforge.net)
Bạn cũng cần xem qua những giúp đỡ sau để install chúng được thành công:
- Installing Readline on OSX without using Fink or Darwinports
- Workaround for Tidy’s platform.h problem
- Installing the GD library on OSX Leopard
Bây giờ thì install các package thứ tự như sau:
Install Xcode
Install MySQL
Download mysql-5.1.22-rc.tar.gz từ http://dev.mysql.com
Uncompress
$/configure --prefix=/usr/local/mysql
$make
$sudo make install
Install Readline
Download source từ ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
Uncompress
$./configure
$make static
$sudo make install static
Install Postgresql
Download source từ http://www.postgresql.org
Uncompress
$./configure --with-prefix=/usr/local/postgresql
$make
$sudo make install
Install GD
Bạn làm theo hướng dẫn ở Veola.net
Install Tidy
Download Tidy source
Uncompress
$./configure
$make
Ở đây bạn có thể gặp một số lỗi, có thể được fix ở đây
$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/binNếu bạn gặp một lỗi ở apr.h, hãy sửa file apr.h trong srclib/ext/includes và đổi thành APR_HAS_SENDFILE thành ‘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
Xong, đó là tất cả bạn cần. Well, a litle long tutorial, is it?
(Ghi rõ nguồn từ tôi, nếu bạn phát hành từ website hnkhoa.com)







