Using PHP with SQL/R -------------------- Revision: 2000-06-28 Prerequisites ------------- 1. You need to install an Apache web server which includes the PHP module and supports ODBC. A pre-compiled binary for the Linux and HP-UX platform is available for download at ftp://ftp.marxmeier.com/sqlr/unsupported/apache/ 2. You may need to install the iODBC driver manager. A pre-compiled binary for the Linux and HP-UX platform is available for download at ftp://ftp.marxmeier.com/sqlr/unsupported/iodbc/ 3. You need to install SQL/R A.02.21 or above. If this system is only acting as an ODBC client (server is running on a different system) you don't need a license key. 4. In order to use the example, you need to install the HP Eloquence sample database which is available for download at ftp://ftp.marxmeier.com/eloq/eloqcgi/ Installation ------------ 1. Please unpack the php_sample.tar.gz archive in your htdocs directory. When unpacked this will create a php_sample directory. cd /var/opt/apache/htdocs/ tar xzf /tmp/php_sample.tar.gz 2. You need to define your data source (virtual data base) in the SQL/R configuration file /etc/opt/sqlr2/odbc.dsn as usual. For the SAMPLE database which could be downloaded at ftp://ftp.msede.com/eloq/eloqcgi/ the following entry is sufficient (if the eloqdb6 server is running locally). --- odbc.dsn --- [SAMPLE] Database = sample --- odbc.dsn --- 3. Next you need to configure your ODBC client. Please edit the file /etc/opt/iodbc/odbc.ini (on HP-UX) and /etc/odbc.ini (on Linux) as specified in the installation instructions. If the SQL/R server is on the local machine, the following content should be sufficient: --- odbc.ini / Linux --- [Default] Driver = /opt/sqlr2/lib/libc6/libsqlrodbc.so --- odbc.ini --- --- odbc.ini / HP-UX --- [Default] Driver = /opt/sqlr2/lib/libsqlrodbc.sl --- odbc.ini --- 4. You may need to change your Apache configuration. Please check the configuration file /etc/opt/apache/httpd.conf. If you have a modular Apache web server, the following directive needs to be enabled: LoadModule php3_module libexec/libphp3.so The following directive needs to be enabled to associate the .php3 files with the PHP module: AddType application/x-httpd-php3 .php3 Running the example ------------------- Please open the /php_sample file in your browser. - Please entry a customer number, such as 32001 in the first field. The Customer record should become visible after pressing submit. - Please entry a matchcode, such as KE% in the second field. A list of matching customers should become visible after pressing submit. Please note: The PHP code is kept to some minimum. It is meant as a simple/stupid example and thats it. I certainly agree that it is long winded and ugly. Enjoy! The SQL/R Team