Showing posts with label PECL. Show all posts
Showing posts with label PECL. Show all posts

25 July 2013

Fixing PHP start-up error: «Unable to load dynamic library»

Suppose you have a PHP extension compiled as ext.so shared library. Let's assume that it depends on sockets extension(which is compiled as sockets.so library file). It means that PHP should load sockets.so before ext.so. Sometimes it doesn't, however. In this case running any PHP script you'd catch a startup error similar to the following:

/usr/lib64/php/modules/event.so: undefined symbol: php_sockets_le_socket in Unknown on line 0

Current version of PHP(at the time of writing 5.5.0 was the latest stable version) loads extensions from php.ini downwards line by line. So the order of "extensions" in php.ini specifies the order of loading of the shared libraries. Most GNU/Linux distributions use the --with-config-file-scan-dir= configure option, which specifies a directory where PHP looks for additional configuration. Usually this directory contains a file per extension. These files are loaded in alpha-numeric order. It means that our ext.ini will be loaded before sockets.ini, as well as ext.so will be loaded before sockets.so, which is not what we wanted!

People in the PHP Group promised to work on this issue. To fix this issue pro tem just rename the ini files in the config file scan directory. Thus our ext.ini has to be renamed to, z-ext.ini, for instance.

11 October 2011

eio - a new PHP extension for asynchronous POSIX I/O

Eio is a new PECL extension for asynchronous POSIX I/O.

Eio provides interface for the libeio library. It means that each POSIX call runs in a separate thread. It is important to aware that the order of ungrouped requests is not precisely known. However, libeio, as well, as eio, supports complex call creation to accumulate a set of regular eio_* requests in a single group request. This allows to create a group request ex. to open, read and close a file.

Currently Windows platforms are not supported.

Any extension-specific suggestions are welcome :)