PHP Compiled From Source Mac OS X Leopard 1

Posted by Ben Reubenstein Sun, 13 Apr 2008 21:06:00 GMT

After getting passenger up and running I realized that I didn't have PHP cranking with the freshly compiled Apache. Here are the steps I took to get PHP going:

  1. Compile PHP from source, be sure to check out ./configure --help for more compile options. Also as always adjust to your systems paths as necessary.

    wget http://www.php.net/get/php-5.2.5.tar.gz/from/this/mirror
    tar -zxvf php-5.2.5.tar.gz
    cd php-5.2.5
    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-curl
    make
    sudo make install
    
  2. I am not sure why but the php bin file ends up being called php.dSYM. There might be a compile option I missed to fix this or it could be the Mac OS X compiler. I fixed the issue by creating a symlink.

    sudo ln -s /usr/local/php/bin/php.dSYM /usr/local/php/bin/php
    
  3. Add /usr/local/php/bin to your path in .bash_login and reload your terminal so that it is in your path. You can confirm that you are getting the right php by issuing:

    which php
    #The command should return:
    /usr/local/php/bin/php
    
  4. Add directives to the httpd.conf for Apache to find the PHP module and handle .php files

    LoadModule php5_module        modules/libphp5.so
    AddHandler php5-script php
    
  5. Restart Apache

    /usr/local/apache2/bin/apachectl restart
    
  6. Put a file in the root of your server or in virtual host directory called info.php with the phpinfo command. Visit the file via your web browser to confirm your install.

    <?php phpinfo() ?>
    

Be sure to leave comments with any issues you have, or updates I can make to this document.

Install RMagick on Mac OS X Leopard from Source 22

Posted by Ben Reubenstein Sun, 16 Mar 2008 21:50:00 GMT

Here are the commands I used to compile the required libraries and programs for RMagick to work on Mac OS X 10.5. It is largely the same as this article with slight adjustments. After completing the process I dumped my history.

Before you can execute these commands, you MUST HAVE

Begin by creating a folder to hold the src.

cd ~
mkdir src
cd src

wget

I like wget, which I use in the commands below. To start compile that or replace the wget command with curl -O.

curl -O http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar -zxvf wget-latest.tar.gz 
cd wget-1.11/
./configure --prefix=/usr/local
make
sudo make install
cd ..

FreeType

wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
tar zxvf freetype-2.3.5.tar.gz 
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..

PNG Library

wget http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.25.tar.gz
tar -zxvf libpng-1.2.25.tar.gz 
cd libpng-1.2.25
./configure --prefix=/usr/local
make
sudo make install
cd ..

JPEG Library

wget ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
tar -zxvf jpegsrc.v6b.tar.gz 
cd jpeg-6b/
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

TIFF Library

wget ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
tar -zxvf tiff-3.8.2.tar.gz 
cd tiff-3.8.2
./configure --prefix=/usr/local
make 
sudo make install
cd ..

GhostScript Fonts

wget http://superb-east.dl.sourceforge.net/sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
tar -zxvf ghostscript-fonts-std-8.11.tar.gz 
sudo mkdir /usr/local/share/ghostscript
sudo mv fonts/ /usr/local/share/ghostscript/fonts/

ImageMagick

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz 
cd ImageMagick-6.3.9/
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local  --disable-static --with-modules --without-perl  --without-magick-plus-plus --with-quantum-depth=8  --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..

RMagick

sudo gem install rmagick

MiniMagick

sudo gem install mini_magick

Clean Up

cd ~
rm -Rfv ./src