tags:

views:

1271

answers:

2

There are tons of links on this topic - but all have a different approach. I have a clean install of os x 10.5.6. I'm using the version of PHP that came with the OS.

I have installed GD using FINK, it has installed associated packages. My question is, how do I now get GD support in PHP?

(pref no macports or marc liyanage suggestions as that involves undoing the other installs of pear, mysql and php I have already done)

A: 

PHP must be compiled with the GD extension enabled.

You can see what extensions and compile flags were used by using the following PHP code:

<?php phpinfo() ?>
Nerdling
+3  A: 

As Nerdling points out, PHP must be compiled with the GD extension enabled, therefore there's no clean way of adding GD2 to the version of PHP that ships with Mac OS X.

This solution worked for me (Mac OS X 10.5.2, should work with any 10.5), but you'll have to make a new PHP installation. However, this will not undo your other installs of PEAR and MySQL, you'll just have to sudo one extra line.

Before we start, if you've already enabled the built in PHP, you'll have to re-comment the PHP line (LoadModule php5_module libexec/apache2/libphp5.so) in (/etc/apache2/)httpd.conf. And now, the steps:

  1. In Terminal.app, type sudo ln -s /etc/apache2 /etc/httpd
    This makes a symlink so entropy's package can install and function correctly.

  2. Download entropy's PHP 5.2.4 for Apache 2 package and install it.

  3. Again in Terminal, type:

    sudo cp /usr/sbin/httpd /usr/sbin/httpd-fat
    sudo lipo /usr/sbin/httpd -thin i386 -output /usr/sbin/httpd

    This downgrades Apache 2 to 32 bits so it can play nice with entropy's PHP package.

    sudo ln -s /usr/local/php5 /usr/local/apache2
    sudo ln -s /usr/lib/libexpat.dylib /usr/local/apache2/lib/libexpat.0.dylib

    This fixes a misplaced file.

    sudo mv /usr/bin/php /usr/bin/php_back
    sudo ln -s /usr/local/php5/bin/php /usr/bin/php

    This fixes possible errors with PEAR/PHP extensions.

  4. Restart Apache (can be done typing sudo apachectl restart).

  5. Upvote ;)

  6. Done.

Some reference: http://www.entropy.ch/phpbb2/viewtopic.php?t=3074

fandelost