I need to compile PHP, MySQL and Apache on my Macbook Pro. It is really not easy! Besides trying to follow the numerous out-dated posts in the entire internet, I have to contend with a lot of technical and software issues with regards to my MAC (I am a new Mac user).
The versions in which I used are
PHP 5.3.2
MySQL 5.1.49
Apache 2.2.16
on Mac OS X 10.6.4
There are some websites which I have referred to and I will definitely recommend you to read.
Most importantly, I saw this…
Hooray! My IMAP-SSL is up!!
The versions in which I used are
PHP 5.3.2
MySQL 5.1.49
Apache 2.2.16
on Mac OS X 10.6.4
There are some websites which I have referred to and I will definitely recommend you to read.
- Sean Coates’ Blog – I figure out how to download PHP and Apache using the terminal PLUS the installation of libiconv-1.13.1. The file iconv caused such a great headache when I tried to compile things using MAMP. He also solved another headache by teaching how to download libpng, libjpg, libxml2, … All these took me several days to solve.
- Zero Inverse’s Blog – I require IMAP-SSL so that I am able to use Gmail from my PHP. Initially, I am using MAMP. But MAMP does not support IMAP-SSL. (It supports IMAP and OpenSSL but you need to recompile the Apache to enable IMAP-SSL support).
- Download and install Xcode. You need Xcode to enable the Make command (and many other developer tools).
- Install Homebrew. I am not using Macports.
- $ curl http://gist.github.com/raw/323731/572b315c4f7ee78244de70e7ad703c8ae324da7a/install_homebrew.rb > install_homebrew.rb
- $ ruby install_homebrew.rb
- Install your own iconv. Although Apple does provide, I faced a lot of problems when I tried to use it.
- $ curl http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz | tar -zx -
- $ cd libiconv-1.13.1
- $ ./configure –prefix=/opt && make && make install
- $ cd ..
- Download and install Apache-HTTPD
- $ curl http://apache.mirror.iweb.ca/httpd/httpd-2.2.16.tar.bz2 | tar -jxf -
- $ cd httpd-2.2.16/
- $ ./configure –enable-rewrite –enable-ssl && make && make install
- $ cd ..
- Install PHP dependencies using Homebrew
- $ echo “gd jpeg libpng libxml2 libzzip mcrypt mysql” | xargs brew install
- $ echo “libpng libxml2 readline” | xargs brew link
- Install PHP from source. A patch is required else the iconv won’t work.
- $ curl -L http://ca2.php.net/get/php-5.3.2.tar.bz2/from/this/mirror | tar -jxf -
- $ cd php-5.3.2
- $ curl http://www.php.net/~scoates/patches/php-5.3.1-Makefile.global-iconv.patch | patch -p0
- $ ./configure –prefix=/usr/local –with-xsl –with-gd –with-zlib-dir –enable-sockets –enable-exif –with-mcrypt –enable-soap –enable-embedded-mysqli –with-mysqli=mysqlnd –with-mysql –with-pdo-mysql –with-curl –with-libedit –with-apxs2=/usr/local/apache2/bin/apxs –enable-mbstring –with-openssl –with-imap –with-imap-ssl –with-iconv=/opt && make && make install
- $ cd ..
- Configure Apache
- Make sure that the module is loaded. It should be loaded by default.
LoadModule php5_module modules/libphp5.so - In /usr/local/apache2/conf/httpd.conf, add these:
If you are using terminal, type this: cd /usr/local/apache2/conf/ [enter] and pico httpd.conf [enter]. Under LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps DirectoryIndex index.html index.php - Before checking phpinfo, it is a must to check whether there are any other applications using the default port 80. My port 80 was occupied by the built in apache and cannot be accessed. I solved it by switching to port 8888. Here are the 2 lines which I edited in my HTTPD.conf file.
Listen 8888 and ServerName localhost:8888 - Now test Apache + PHP by creating php.info(). $ echo “<?php phpinfo(); ?>” > /usr/local/apache/htdocs/index.php
$ ln -s /usr/local/apache2/bin/apachectl /usr/local/bin/apachectl
$ sudo /usr/local/bin/apachectl restart - Now visit localhost:8888/index.php. You should see this:
Most importantly, I saw this…
Hooray! My IMAP-SSL is up!!
No comments:
Post a Comment