0

I dont want to jump into everything as I'm about to leave work, I would just like suggestions or things to change. I have a centos linux server and this is the code that's giving me the error and i'm not sure whats wrong since I downloaded it like this and it wont work.

if (!extension_loaded('librets')) {
  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
    if (!dl('php_librets.dll')) return;
  } else {
    // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
    if (PHP_SHLIB_SUFFIX === 'dylib') {
      if (!dl('librets.so')) return;
    } else {
      if (!dl('librets.'.PHP_SHLIB_SUFFIX)) return;
    }
  }
}

I get the following error:

Fatal error: Call to undefined function dl() in /home/removed/public_html/test/rets2/librets.php on line 22

I'm not sure whats wrong..

Anyone?

I like php
  • 29
  • 2
  • 7

1 Answers1

0

dl is not a good solution for loading libraries under certain conditions, which is why the function has been removed from several of the SAPI-s (Server APIs - the connection between PHP and the server running PHP). You'll either have to add it to php.ini or load it through whatever means your server has available for that. If you're on shared hosting, the hoster may also have disabled dl() for security reasons.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • What would you suggest I use to load the librets.dll file? – I like php Aug 22 '12 at 15:07
  • If you're sure that it's the PHP extension (the usual naming convetion for PHP extensions are php_extension.dll, so php_rets.dll would be better), you can add it to your php.ini file - most distributions use a system where you have .ini files in /etc/php5/conf.d/ or something similar, and you can create a rets.ini with "extension=php_rets.dll" there. Restart apache or php-fpm and the extension should be visible in the phpinfo() output. If it's not, check the error log. If you're on shared hosting, contact support. – MatsLindh Aug 22 '12 at 20:43