Tuesday, March 25, 2014

Install phalcon with MAMP


This is instructions on how to compile and install the phalcon extension on Mac OS X (Lion), along with command-line tools. Everything will be done through the terminal, except installation of Xcode and the command-line tools.
Tested with MAMP 2.1.2/PHP 5.4.4.
I assume that you already have MAMP installed. I am using MAMP 2.1.2 with PHP 5.4.4. You should change the paths throughout the post, to which ever versions of PHP and MAMP you are using. Usually it will just involve changing php5.4.4 to whatever php version you are using.

Xcode

Make sure that Xcode is installed, and also that the command line tools has been installed (Xcode > Preferences > Downloads).

PHP source code

Before you can install the phalcon module, you will need to have the PHP source code at hand (the PHP header files), so phpize works.
Download MAMP_components_2.1.2.zip to your Downloads folder, and extract it. If you are using another version of MAMP, take a look here.
Note: If you can’t find the MAMP components, or just don’t want to download the full package (it is unnecessary if you only need to install this extension), just download the appropriate source file from php.net. The MAMP components image is only infrequently updated, and probably is out of date.
# cd ~/downloads/MAMP_components_2.1.2/
# tar xzvf php-5.4.4.tar.gz
# mkdir /Applications/MAMP/bin/php/php5.4.4/include
# mv php-5.4.4 /Applications/MAMP/bin/php/php5.4.4/include/php
# cd /Applications/MAMP/bin/php/php5.4.4/include/php
# ./configure

autoconf

I had an issue that phpize could not find the autoconf command. So I installed it manually (this was version 2.69, you should change the path to the version you have downloaded).
# cd ~/downloads
# curl -OL http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
# tar xzvf autoconf-latest.tar.gz
# cd autoconf-2.69
# ./configure ; make ; sudo make install

automake

I had an issue that the phalcon install script could not find the automake aclocal command. So I installed it manually.
# cd ~/downloads
# curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
# tar xzvf automake-1.14.tar.gz
# cd automake-1.14
# ./configure ; make ; sudo make install

libtool

I had an issue that the phalcon install script could not find the automake libtoolize command. So I installed it manually.
# cd ~/downloads
# curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.tar.gz
# tar xzvf libtool-2.4.tar.gz
# cd libtool-2.4
# ./configure ; make ; sudo make install
(You might need to open a new terminal window after this)

phalcon extension

Now we will need to download and install the phalcon extension. The first command is to make sure that php is retrieved from the right location.
# export PATH=/Applications/MAMP/bin/php/php5.4.4/bin:$PATH
# cd ~/downloads
# curl -L -o cphalcon-master.zip https://github.com/phalcon/cphalcon/archive/master.zip
# unzip cphalcon-master.zip
# cd cphalcon-master/build
# sudo ./install
When the phalcon extension has been installed, you enable it in PHP by doing this:
# echo "extension=phalcon.so" >> /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
And that’s the end of it. Restart MAMP and you are ready to go!

Related Posts:

  • Hướng dẫn Chmod an toàn cho website DigiStar đề nghị CHMOD như sau để bảo vệ an toàn cho website tại host của DigiStar: 1) CHMOD thư mục Public_html thành 710 thay vì mặc định là 750 việc này sẽ giúp bạn bảo… Read More
  • What are the best linux permissions to use for websiteQuestion: I have a Linux web server running Apache2 that hosts several websites. Each website has its own folder in /var/www/. /var/www/contoso.com/ /var/www/contoso.net/ /var/www/fabrikam.com/ The base directory /var/www/… Read More
  • Tối Ưu Hóa Và Bảo Mật Apache 1. Edit một số directive default trong httpd.conf để giảm thiểu việc lộ lọt thông tin cấu hình của máy chủ hoặc các tác vụ ko cần thiết:TraceEnable Off : Disable TRACE request methodServerSignature Off : Disable vi… Read More
  • .htaccess rewrite tips .htaccess rewrite tips #1 12-08-2013, 02:52 AM Be aware that mod_rewrite (RewriteRule, RewriteBase, and RewriteCond) code is executed for each and every HTTP request that accesses a file in or below the directory where t… Read More
  • Giám sát hệ thống Linux với netstat Netstat là một công cụ hữu ích của Linux cho phép bạn kiểm tra những dịch vào nào đang kết nối đến hệ thống của bạn. Nó rất hữu ích trong việc phân tích cái gì đang xảy ra trên hệ thống của bạn khi bạn cố gắng ngăn chặn một … Read More