Install the PHP interface

If you want to provide interactive access to your RefDB databases through the web, consider installing the PHP web interface. This web frontend provides a convenient way to perform the most common user tasks, like running queries or adding datasets.

Prerequisites

Please check the following prerequisites on your computer before attempting to install the PHP interface

Web server

Any web server that is capable of running PHP scripts. If you don't run a web server anyway, Apache is always a good choice to start with. Both versions 1.3.x and 2.x will work just fine.

PHP interpreter

You need PHP5 or later (PHP 8.0 is current at the time of this writing). When building PHP, make sure to configure the software appropriately so the PHP Apache module gets built. If you install a prebuilt package, you may have to select an extra package that contains the appropriate module for your web server.

With the exception of session support, the RefDB PHP interface relies solely on core features of PHP. You may therefore have to install PHP session support separately. However, on some systems like FreeBSD, "core" does not mean "it's there". If the PHP core is split into several packages, you may also have to install DOM, XML, and XSL support separately.

Web server configuration

The following instructions assume that you use Apache as your web server. The configuration file is usually /etc/apache/httpd.conf or /usr/local/etc/apache/httpd.conf.

  • Locate the section "Dynamic Shared Object (DSO) Support". Check if the PHP module is loaded anyway. If not, add a line like the following:

    	    LoadModule php_module         libexec/apache24/libphp.so
    	  
  • Further down there should be a section containing Aliases. Create a new one within this section like this (Apache up to version 2.2):

        Alias /refdb/ "/usr/local/share/refdb/www/"
    
        <Directory "/usr/local/share/refdb/www">
            AllowOverride None
            Order allow,deny
            Allow from all
            AddType application/x-httpd-php .php .phtml
        </Directory>
    	  

    If you run Apache version 2.4 or later, use the following configuration instead:

        Alias /refdb/ "/usr/local/share/refdb/www/"
    
        <Directory "/usr/local/share/refdb/www">
            AllowOverride None
    	Require all granted
            AddType application/x-httpd-php .php .phtml
        </Directory>
    	  

    The paths point to the files that RefDB installs with all other shared files. If you intend to customize or modify the interface, you can copy the files to a directory in your home folder and change the directories in the config file accordingly.

  • Finally you'll have to let the Apache server re-read it's configuration file, e.g. on FreeBSD:

    ~# service apache24 restart

Test your PHP interface

To see the PHP interface in action, first make sure that the RefDB application server is running:

~# refdbctl start

Now start your web browser and point it to:

localhost/refdb/

Please note the trailing slash! Now you should be greeted by the login screen.