Wherein we write down some stuff that we know.

Archive for the ‘PHP’ Category

Upgrading PEAR on RHEL 4

Monday, November 27th, 2006

Problem: You need to install PEAR packages that use package.xml version 2.0 but you’re running the stock RedHat RPM of PHP which is at php-pear-4.3.9-22.i386.prm (aka pear 1.3.1).

pear upgrade Date
downloading Date-1.4.7.tgz ...
Starting to download Date-1.4.7.tgz (55,754 bytes)
.............done: 55,754 bytes
No handlers for package.xml version 2.0

You can’t upgrade PEAR using pear upgrade PEAR because you need at least pear-1.3.3 to get to the latest version.

requires package `PEAR' >= 1.3.3
PEAR: Dependencies failed

Solution:

  1. Download PEAR 1.3.3
  2. Install with pear upgrade /path/to/pear-1.3.3
  3. Upgrade PEAR with pear upgrade pear
  4. Optional: Upgrade your existing packages with pear upgrade-all

You may now install packages that use package.xml version 2.0. You are also ahead of the game with regard to RPMs. The next RHN update may hose what you have just done. You should probably consider marking php-pear as a package to ignore.

Update: As noted in the comments, you will need to upgrade to 1.4.11 before you can upgrade to 1.5.0.

RHEL 4 and php-xslt

Wednesday, September 20th, 2006

It all started out innocently enough…a JIRA issue for me to install the PHP XSLT module. How hard could it be? When you ask yourself that question immediately realize that you are in trouble.

You’re running the stock RedHat PHP rpm. RedHat Network doesn’t provide an rpm for php-xslt. So you need to build a php-xslt rpm from source. How do you do that and avoid all the issues we ran into? Good question.

  1. Get and build a js rpm from source.
    1. rpm -i js-version.srpm
    2. rpmbuild -bb /usr/src/redhat/SPECS/js.spec
    3. install js and js-devel rpms
  2. Get and build a sablotron rpm from source. You need to build from source to avoid problems later on that I will explain.
    1. rpm -i sablotron-version.srpm
    2. Edit /usr/src/redhat/SPECS/sablotron.spec to remove the --with-readline configure option. If PHP tries to load a module that dynamically links to readline, it will barf.
    3. rpmbuild -bb /usr/src/redhat/SPECS/sablotron.spec
    4. install sablotron and sablotron-devel rpms
  3. Get and install php source from RHN
    1. up2date --get-source php
    2. rpm -i /var/spool/up2date/php-version.srpm
  4. Patch php.spec to enable php-xslt. A patch that works against php-4.3.9-3.15 is available here or here.
    1. cd /usr/src/redhat
    2. patch -p0 < /path/to/patch (You should see that 5 hunks succeeded.)
    3. Edit php.spec so that %{!?xslt:%define xslt 0} says %{!?xslt:%define xslt 1}
  5. Build and install php
    1. rpmbuild --bb /usr/src/redhat/SPECS/php.spec
    2. rpm -U --replacepkgs --force --hash /path/to/php /path/to/php-xslt
    3. service httpd reload

How hard could it be, indeed…

Technorati tags: ,

Market Pressure

Tuesday, March 7th, 2006

Zend is making a MVC framework for PHP. I would guess that most of the pressure to make this is coming from Rails and from the various python frameworks (Google anyone?). I hope it’s not going to be “Rails for PHP!” because I doubt that would work. This certainly isn’t the only MVC framework for PHP, but I’m sure it will be the best supported.