apt-get安装php-db等效的FreeBSD

I am trying to get daloradius https://github.com/lirantal/daloradius to work in FreeBSD with php 5.6. When I try to login, I get this error:

Fatal error: Class 'DB' not found in /.../library/opendb.php on line 86

Tried the following but didn't work:

pkg install php-dba
pear install DB
pear install MDB2

Now on my linux box, I got this error initially but when I ran the following it worked:

apt-get install php-db

In FreeBSD this doesn't work. Can anyone tell me the equivalent of this to FreeBSD? Or has anyone been able to get daloRadius to work in FreeBSD? Thank you so much.

PS I also tried pointing the include code to the absolute location of the DB.php (/usr/....../pear/DB.php) and it didn't work.

If I am right DBA is not in the default pkg php56-extensions but what you can do is install from source and select the required extensions, for doing this do:

# portsnap fetch extract

Then:

# cd /usr/ports/lang/php56-extensions
# make config <--- select [x] DBA dba support
# make install

That will install the DBA extension, more info about using ports can be found here: https://www.freebsd.org/doc/handbook/ports-using.html

lang/php56-extensions is a meta-package that just pulls in other dependencies according to config. So, instead of installing all default extensions, you can install just databases/php56-dba.

And it is not necessary to compile it, pkg install php56-dba will also do.

I think what you want is the pear DB library. On FreeBSD the pear packages have a pear- prefix instead of php-

Try:

# pkg install pear-DB

You are correct to use pkg. But you have to use the correct package-names. The name of the php-dba package on FreeBSD today depends on the PHP-version you'd like:

  • php56-dba
  • php70-dba
  • php71-dba

For the pear packages you listed, the package-names are pear-DB and pear-MDB2 respectively. Both are built using PHP-5.6 by default, however, so, if you want to use the versions pre-built for you, you'll need to use PHP-5.6 (and php56-dba).

But it seems, you've installed all of the relevant packages already -- and your problem is with a particular application (daloradus?). Thus, your question is neither about FreeBSD nor installing packages on same, and you should edit its title and tags to match.