Thursday, January 24, 2008

PHP Shared Object

QUESTION

Hello,
We recently purchased the PHP shared object from you guys and are having problems getting it running. We are using PHP 5.2.5 on Red Hat Linux 9, and are getting the following error when we try to dynamically link your mhdrg.so library:

Warning: dl(): unable to load dynamic library './mhdrg.so' - mhdrg.so:
undefined symbol: zend_list_find

Any ideas? Let me know if you need more info or if I need to be addressing this question to RTR. Also, if we can't get this to work fairly easily, would we have the option of "trading" this PHP .so for your C callable object?


ANSWER

As I understand it, things are supposed to work like this:

 - you put mhdrg.so in a place in your file system that is both
   - readable by your web server
   - not accessible by the world or the world can steal it

 - you use the dl() primative in PHP to load the extension, like so:

    if (!extension_loaded('mhdrg')) {
        if (!dl('mhdrg.so')) {  // this should be in a protected directory
            exit;
        }
    }
When I deliberately move mhdrg.so on our test system, I get the following error:

Warning: Unable to load dynamic library './mhdrg.so' - ./mhdrg.so: cannot open shared object file: No such file or directory in /home/mnh/public_html/PHP/tryit.php on line 5

So I am guessing that wherever you have put mhdrg.so is not readable by the user your web server runs as. Have you put mhdrg.so in the same document directory as your document? If not, you could trying putting tryit.php and mhdrg.so in the same document directory and confirming that tryit.php works on your systems.

That said, we would be happy to exchange your PHP shared object for a C-callable object if that works better for you.

No comments:

Post a Comment