GD2 not showing up in phpinfo

Ryan Schmidt ryandesign at
Fri Sep 21 12:30:02 PDT 2007

On Sep 18, 2007, at 22:23, SpeakToMeNow wrote:

> Hi this is probably pretty basic, but I've recently added a new port
> for the first time since installing darwinports ages ago.
> I installed mac ports , updated everything as per instructions and
> then installed GD2, but it's not showing up when I load my phpinfo
> file:
> './configure' '--prefix=/opt/local' '--mandir=/opt/local/share/man'
> '--infodir=/opt/local/share/info'
> '--with-config-file-path=/opt/local/etc' '--enable-calendar'
> '--with-iconv=/opt/local' '--enable-exif' '--enable-ftp'
> '--enable-wddx' '--with-zlib=/opt/local' '--without-mysql'
> '--with-gettext=/opt/local' '--with-expat-dir=/opt/local' '--with-xml'
> '--with-xmlrpc' '--enable-filepro' '--enable-bcmath'
> '--enable-trans-sid' '--enable-cli' '--with-pear=/opt/local/lib/php4'
> '--with-openssl=/opt/local' '--enable-mbstring' '--enable-dbx'
> '--enable-safe-mode' '--program-suffix=4'
> '--includedir=/opt/local/include/php4' '--libdir=/opt/local/lib/php4'
> '--with-ldap=/usr' '--with-kerberos=/usr' '--with-iodbc=/usr'
> '--with-apxs=/usr/sbin/apxs' '--with-mysql=/opt/local' '--enable-xslt'
> '--with-xslt-sablot=/opt/local' '--with-iconv-dir=/opt/local'
> I tried which gd2 but it reports:
> no gd2 in /bin /sbin /usr/bin /usr/sbin /opt/local/bin

Perfectly normal; there is no binary called "gd2" so there's nothing  
for "which" to find.

> but I can see all the files so if I type:
> which gd2topng
> it tells me
> /opt/local/bin/gd2topng
> I've restarted apache 1.3 but it doesn't show up?
> Is there something I need to do to get GD2 to start working and show
> up in my phpinfo.php page?
> I even tried to upgrade to php5 but I'm getting this error:
> --->  Activating php5 5.2.4_0+darwin_8+macosx
> Error: Target org.macports.activate returned: Image error:
> /opt/local/etc/php.ini-dist is being used by the active php4 port.
> Please deactivate this port first, or use the -f flag to force the
> activation.
> Error: Status 1 encountered during processing.

Correct, you currently cannot have php4 and php5 installed  
simultaneously. It would be nice, but I haven't spent any effort on  
it, since php4 is pretty much at end of life.

> I don't want any of my existing services to die and I really don't
> know my way around terminal too well.
> Can anyone give me some advice/commands to get things up and running?

Judging by "port variants php4", you would need to indicate that you  
want the +gd variant, if you want gd functions. It looks like php4  
uses the gd library built into the php source, and not the gd library  
provided by the gd2 port. It looks like if you had selected the +gd  
variant, the ./configure line shown in your phpinfo would have shown  
"--with-gd" and a few other arguments.

So... you will want to use "port installed php4" to see what you  
currently have installed, and reinstall it with +gd added. For  
example, if you currently have "php4 4.4.7_0+darwin_8+macosx"  
installed, then you should "sudo port install php4 +darwin_8 +macosx  
+gd". (Actually, +darwin_8 is auto-selected on Mac OS X 10.4 systems,  
and +macosx is auto-selected on any Mac OS X, so you really only need  
"sudo port install php4 +gd".) Once it gets to the activating stage,  
it will complain that another version of php4 is already active. So  
you deactivate it with "sudo port deactivate php4 4.4.7_0+darwin_8 
+macosx" and activate the new one with "sudo port activate php4  
4.4.7_0+darwin_8+gd+macosx". Then you stop and start your web server  
and make sure everything's ok. If it isn't, you can deactivate the  
one with gd again and activate the one without gd again, stop and  
start your web server, and you're back in business. Or if the gd  
version works fine, then you can eventually "sudo port uninstall php4  
4.4.7_0+darwin_8+macosx" to fully get rid of the old version.

More information about the macports-users mailing list