Working on php-cgi variant PHP-FPM 0.6.0.
Link: http://dreamcat4.jottit.com/new_php5-fpm_testing_candidate

The resulting FPM binary works BUT refuses to load Zend extensions. Oh
- so close!

[email protected]:/usr/local/src/play/f$ sudo /etc/init.d/php5-fpm start
Starting php_fpm Failed loading /usr/lib/php5/20060613+lfs/xcache.so:
/usr/lib/php5/20060613+lfs/xcache.so: undefined symbol:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20060613+lfs/pdo.so' -
/usr/lib/php5/20060613+lfs/pdo.so: undefined symbol:
zend_objects_store_add_ref in Unknown on line 0

Having discounted the usual suspects (pdo=shared, wrong php-api, etc)
Im left examining how the Zend sourcecode. PHP is being compiled
separartely and THEN integrated into the FPM program. The author took
a novel approach for the FPM project and is linking PHP_GLOBAL_OBJS
(all the built php object files)... then adding in his FPM part during
the link stage. The FPM code replaces what would otherwise be the
FastCGI part of PHP. BUT he must also replace the SAPI with his own
modified / tweaked SAPI...

Bear with me please. It seems the SAPI is loading Zend extensions
which is why i must ask:

In PHP build, the build target of SAPI is like this:
PHP_SAPI_OBJS = sapi/cgi/fastcgi.lo sapi/cgi/cgi_main.lo
sapi/cgi/getopt.lo main/internal_functions.lo

Why is main/internal_functions.c specified in PHP as a SAPI object ?
Are any files included by internal_functions.c referencing back to
SAPI? The FPM author did include that internal_functions.lo in the
linking, but he didn't compiled it again himself, (unlike the three
other SAPI '.c' files).

FPM Makefiles looks like this:

sed -e 's,.*= ,,'`
PHP_OBJS="$PHP_GLOBAL_OBJS main/internal_functions.lo"

php_fpm_LDADD = \
sapi/libsapi.la \
fpm/libfpm.la \
../libevent/libevent.la \

libsapi_la_SOURCES = \
cgi_main.c \
fastcgi.c \

Going back to the original error, I am hopefully correct to be
assuming that "function_add_ref" is the Module Initialization Function
(MINIT) for XCache. So how does PHP find the name of a (MINIT) that it
should run? And after obtaining the name of the MINIT, why can't the
dynamic linker program resolve to the address? In other words - why
choke *after* finding the name of the MINIT function and not before?
Not much clues here which is why its beginning to feel like a dead end
now. Maybe theres something else I can try?

[email protected]

Search Discussions

  • Dreamcat four at Aug 22, 2009 at 7:40 pm

    On Sat, Aug 22, 2009 at 8:11 PM, dreamcat fourwrote:
    now. Maybe theres something else I can try?
    Ahh !
    It appears I should be looking in sapi/cgi_main.c overridden by PHP-FPM.
    Sorry to bother you all with my previous message.

    Many thanks

    [email protected]

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
postedAug 22, '09 at 7:11p
activeAug 22, '09 at 7:40p

1 user in discussion

Dreamcat four: 2 posts



site design / logo © 2023 Grokbase