Subject: Re: PHP - problems with pear install & gd dependancy (+ fix)
To: Dave Tyson <>
From: Johnny C. Lam <>
List: pkgsrc-users
Date: 02/24/2006 16:10:47
On Fri, Feb 24, 2006 at 02:04:27PM +0000, Dave Tyson wrote:
> A co-worker reported he had problems installing various php modules needed by
> snort under NetBSD-3. Searching with Google shows a few other people have
> reported the same problem against FreeBSD and Linux when using the pkg
>  system.
> The system has the following php / graphics packages installed
> php-4.4.1nb2
> php-mysql-4.4.1
> gd-2.0.33nb1
> php-gd-4.4.1
> phpinfo shows gd is installed correctly (both from the command line and web
> interface)
> Trying to use pear to install Image_Color gives the following error:
> root(napoleon)htdocs$ pear install Image_Color
> downloading Image_Color-1.0.2.tar ...
> Starting to download Image_Color-1.0.2.tar (-1 bytes)
> .........done: 33,792 bytes
> 'gd' PHP extension is not installed
> Image_Color: Dependencies failed
> After a lot of messing about I looked at the pear script in /usr/pkg/bin.
>  This sets a few variables and then finally calls php so:
> exec $PHP -C -q $INCARG -d output_buffering=1 -n $INCDIR/pearcmd.php "$@"
> However a quick look at the php man pages shows the -n option tells php
> 'No php.ini file will be used'
> If you remove the -n option in the line then the pear install works fine as
> the php.ini file is read and shows that gd is registered.
> I don't much about php, but this looks like a bug in the pear script - can
> someone who knows a bit more about php confirm this and I will send-pr it
> (unless they get there first)

The CVS history for www/php4/patches/patch-al, which adds the "-n",

    completely ignore system php.ini for all pear-related operations;
    this is necessary to avoid being subject to e.g. open_basedir or
    safe_mode settings

I'm guessing that this is because jdolocek didn't want any user settings
to affect the installation of various PEAR modules by the php4 package.
However, in your case, this causes the to not be loaded, which
is apparently needed by the Image_Color PEAR module.

I think you should submit a PR about this.  I think pkgsrc should
really somehow use its own php.ini file for module installation if it
wants to insulate itself from users' custom php.ini settings.


	-- Johnny Lam <>