Subject: pkg/32934: PHP - problems with pear install & gd dependancy
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Dave Tyson <dtyson@mr-cs2pig.liv.ac.uk>
List: pkgsrc-bugs
Date: 02/26/2006 14:55:00
>Number:         32934
>Category:       pkg
>Synopsis:       PHP - problems with pear install & gd dependancy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 26 14:55:00 +0000 2006
>Originator:     Dave Tyson
>Release:        NetBSD 2.1_STABLE
>Organization:
The University of Liverpool
>Environment:
System: NetBSD napoleon 2.1_STABLE NetBSD 2.1_STABLE (LIVSTD) #3: Fri Nov 4 15:06:23 GMT 2005 root@dnsx.liv.ac.uk:/usr/obj/sys/arch/i386/compile/LIVSTD i386
Architecture: i386
Machine: i386
>Description:
After installing php & php-gd successfully, attempts to use the pear command to
install modules which depend on gd fail because the pear command invokes php
with the -n option which disables scanning php.ini. Because of this pear install
fails to note that gd is installed and refuses to add components depending on gd.
>How-To-Repeat:
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
>Fix:
A quick & dirty fix is to edit the pear script change the line invoking 
php to remove the -n option.

Jonny Lam notes that: 

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

     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 php_gd.so to not be loaded, which
 is apparently needed by the Image_Color PEAR module."

A possible 'correct' fix would be to maintain a separate 'install.php' 
file which is initialised when php is installed and updated when other
php components like php-gd & php-mysql are added/removed. This could 
then be referenced by pear to find out what modules are installed rather
than rely on the main php.in file which may be changed by the user. 

Dave