Solution: Building php-cli for eZ publish command line scripts


Building standalone php-cli (php 4.4.4 + refcount patch) for eZ publish

The Patch

eZ publish and eZ publish command line scripts like the update scripts which interact with the content object database can use so many references that it causes PHP to segfault, crash, fail, die ...

This problem has been around for a long time and has only partially been resolved in PHP 4.4.x.

To help reduce the chance PHP might segfault, one may 'patch' PHP source code and recomple PHP.

Refcount (Increased Reference Support) Patch from

Patching PHP

Here are the commands I used today patch the php-cli source to include improved reference support.

# php-cli (php 4.4.4) compile instructions:


tar -vzxf php-4.4.4.tar.gz

cd php-4.4.4

# apply patch

vi Zend/zend.h

Building PHP

Here are the commands I used today to compile php-cli from source.

mkdir /usr/local/php-cli-4-4-4-refcount

./configure --prefix=/usr/local/php-cli-4-4-4-refcount --disable-cgi


make test

make install-cli


Use this patched php-cli binary to run your eZ publish command line, cronjob, update scripts

Example Use Case


Another Patch

Another patch has been documented to solve other reference related problems related to eZ publish's PHP code. If the above patch does not solve your breakdowns, consider applying this other patch and test the results.