PEAR Manual

V. Radius


About Radius

This package is based on the libradius of FreeBSD. This PECL adds full support for Radius Authentication (RFC 2865) and Radius Accounting (RFC 2866). This package is available for Unix (tested on FreeBSD and Linux) and for Windows.

Note: An exact description for libradius can be found here. A detailed description of the configuration file can be found here.

Contact Information

If you have comments, bugfixes, enhancements or want to help developping this you can send me a mail at Binaries for Windows can be downloaded from here.


Howto install the package?

or if you would like to have it as .so:

  • untar the package

  • run phpize in the radius-x.x directory

  • run ./configure in the radius-x.x directory

  • make; make install

for windows I recommend to use the php_radius.dll from


Howto start?

Take also a look at the examples in this package.

The package contains an example php script. This script demonstrates howto authenticate with radius using PAP or CHAP (md5). If you authenticate with MSoft Radius servers then its not possible to use CHAP (md5). If you would like to authenticate with MSoft Servers you have to use MS-CHAPv1 or MS-CHAPv2, but its more complicated, because you need md4, sha1 and des to generate the right data. The enclosed examples demonstrate all authentication-methods, including MS-CHAPv1 and MS-CHAPv2. To get the MS-CHAP to work you need the mcrypt and the mhash extension, starting with version 1.2 of the package, the mcrypt extension is no longer needed.

Table of Contents
radius_auth_open -- Creates a Radius handle for authentication
radius_acct_open -- Creates a Radius handle for accounting
radius_strerror -- Returns an error message
radius_config -- Causes the library to read the given configuration file
radius_add_server -- Adds a server
radius_create_request -- Create accounting or authentication request
radius_put_string -- Attaches a string attribute
radius_put_int -- Attaches an integer attribute
radius_put_attr -- Attaches a binary attribute
radius_put_addr -- Attaches an IP-Address attribute
radius_put_vendor_string -- Attaches a vendor specific string attribute
radius_put_vendor_int -- Attaches a vendor specific integer attribute
radius_put_vendor_attr -- Attaches a vendor specific binary attribute
radius_put_vendor_addr -- Attaches a vendor specific IP-Address attribute
radius_send_request -- Sends the request and waites for a reply
radius_get_attr -- Extracts an attribute
radius_get_vendor_attr -- Extracts a vendor specific attribute
radius_cvt_int -- Converts raw data to integer
radius_cvt_string -- Converts raw data to string
radius_cvt_addr -- Converts raw data to IP-Address
radius_request_authenticator -- Returns the request authenticator
radius_server_secret -- Returns the shared secret
radius_demangle -- Demangles data
radius_demangle_mppe_key -- Derives mppe-keys from mangled data
radius_close -- Frees all ressources
constants -- Predefined constants