php4-4.3.3 with PEAR

Oliver Crow ocrow at simplexity.net
Fri Aug 29 19:14:51 PDT 2003



I've been having difficulties upgrading my php4 ports.  I'm all sorted
now, but just in case others can benefit from my hair pulling ...

First up ... how to build the lang/php4 port without having to fill out
the menu of choices every time you upgrade. Create a file Makefile.local
in the /usr/ports/lang/php4 dir with your options -- e.g.:

PHP4_OPTIONS=   \
    OPENSSL MCRYPT MHASH CURL POSTGRESQL \
    CTYPE OVERLOAD PCRE POSIX SESSION TOKENIZER XML XML_RPC ZLIB

The list of available options is in lang/php4/Makefile
When you want to build do:

% cd /usr/ports/lang/php4
% make -DBATCH

or if you prefer portupgrade

% portupgrade -N php4 -M BATCH=yes


Next, if you upgraded the www/mod_php4 port and find that you are getting
an error message like "(PEAR.php): failed to open stream" or "Failed
openning required 'PEAR.php', it may be because the php4 port no longer
installs the PEAR libraries (/usr/local/lib/php/PEAR*) by default.

Do a 'pkg_info -L mod_php4\* | grep PEAR' to see if the files are missing.
If they are, deinstall 'www/mod_php4' and install the 'lang/php4' port
instead.  That port comes with the command line version of php, which is
required for the PEAR libraries.

Why are the PEAR libraries removed if you're building the apache module
but not the command line version?  Using the configure option
--disable-cli forces php to build --without-pear.  According to the php
CVS comments for configure.in v1.353 from June 2002:  "Disable installing
pear when --disable-cli is used since pear installer needs cli to
function."  So there you have it, you need to have /usr/local/bin/php to
install the PEAR libraries.  Weird but true.


Once you've installed lang/php4 install the pear meta port
'devel/pear'. That should give you all of these packages:

pear-Archive_Tar-1.1
pear-Auth-1.2.2
pear-Auth_SASL-1.0.0_2
pear-Console_Getopt-1.0_1
pear-DB-1.5.0.rc1
pear-File-1.0.3_1
pear-Mail-1.1.1
pear-Mail_Mime-1.2.1_3
pear-Net_SMTP-1.2.3
pear-Net_Socket-1.0.1_1
pear-PEAR-1.2.1


If you installed the lang/php4 port and the pear ports and your scripts
are still throwing PEAR errors, it may be because the default PEAR install
directory has moved.  It used to be in /usr/local/lib/php, but it's now in
/usr/local/share/pear.  So, edit your /usr/local/etc/php.ini
file to contain the appropriate include_path ... e.g.:

include_path = ".:/usr/local/share/pear/"



Just as an aside, I have to say, it really irritates me when installing a
"highly recommended" bug fix upgrade breaks a bunch of working
applications, just because no one has bothered to document how all of the
install changes are going to affect users who are upgrading.  Generally
FreeBSD does a really good job in this regard, but when other packages
play fast and loose, its the port maintainers and the users who are left
trying to clean up and document the mess.


Oliver


More information about the freebsd-ports mailing list