  To be able to use PHP interfaces for the RDBMS Linter SQL, you should 
have a PHP interpreter installed on your host, either as an executable 
module or as a shared library (module) for the Apache Web server. If you 
do not have PHP installed, the source code may be found at 
http://www.php.net. At present we support PHP3, 4 and 5.

                Integration of Linter and PHP.
                
  Linter ships with ready-to-use loadable Linter interface libraries for 
PHP, as well as with the source code and libraries for building 
interfaces for future PHP releases (Note. Some distributives may not 
include loadable libraries).
  To use the Linter PHP-interface:
1. Install PHP in the system as an executable file or a module for the 
Apache Web server (if PHP has not been installed yet) (see the 
documentation for PHP and Apache).
2. Define the path to the PHP executable file and the shared libraries.
  To do this, you should execute a simple PHP program.
  Starting info.php
   <?PHP
   phpinfo();
   ?>
  End of info.php
  The program may be executed in two ways, depending on the PHP 
installation.
  If PHP is used by the Apache Web server, just place the program in the 
directory of HTML documents and select it as a hyperlink in a Web 
browser (Netscape, Microsoft Internet explorer etc.).
  If PHP is installed as an executable module, execute the program 
startup command and redirect the result to the file:
   >php info.php > phpinfo.html
Next, open the phpinfo.html file in your Web browser.
  Of all the information therein, we will need only two options: 
"php.ini file path is set to" and "extension_dir".
3. Copy the file libphp3_linter.so (for php-3.x.x.) or libphp_linter.so 
(for php-4.x.x.) from the bin directory of the Linter distributive to 
the PHP extension directory, or correct the "extension.dir" option of 
the php.ini file, so that it would point to the bin directory of the 
Linter distributive.
4. Use the PHP dl("libphp_linter.so") command for php-4.x.x or 
dl("libphp3_linter.so") for php-3.x.x to load the interface during the 
program execution, or insert the line "extension=libphp[3]_linter.so" 
into the php.ini file to load the interface before starting any PHP 
program. The universal code described in the samples/php/library.php 
file of the Linter distributive may as well be used for loading. After 
loading the interface, you may use the DBMS Linter access functions in 
the program (see the documentation).

    Building the Interface as a Shared Library.
    
  Building may be required in the following situations:
1. Ready-to-use compiled shared libraries are not included in the 
distributive.
2. You are using php-4.x.x, and your PHP version does not correspond to 
the version for which the Linter interface has been built.

  To build the interface, you should have the PHP source code (this may 
not apply to PHP4 that installs its own header files into the system), 
configured and ready for compilation, the C-compiler and the make 
utility. Start the Configure program from the Linter distributive root, 
and answer "yes" to the question about the configuration of the 
distributive for building PHP interfaces. Further on, you will be 
offered to find the PHP3 or PHP4 source code. You may as well cancel the 
search and enter the complete path to the source code manually. In case 
of incorrect input you will be asked to re-enter the data. A refusal to 
re-enter will be treated as cancellation of building the interface for 
the current PHP version. You may as well edit the Definition file of the 
Linter distributive manually by setting the SUPPORT_PHP or SUPPORT_PHP4 
variable values (for PHP3 and PHP4 respectively) to "1". The PHPINCLUDE 
and PHP4INCLUDE variables should define the complete path to the PHP3 
and PHP4 source code.
  Go to the php directory of the Linter distributive and submit the 
"make" command for interface building. Upon compilation and building, 
the ready-to-use shared interface libraries will be placed to the bin 
directory of the Linter distributive.

            Building extensions using phpize.

  Since about php-4.4 it is possible to use phpize to prepare a loadable
extension for building. In this case the module source files and config.m4
must be copied into a separate directory. Then you should go to this directory
and execute phpize. As a result a file 'configure' will be created. Run it with
--help to see the available options. To configure the build, execute it with
--with-linter=path, where 'path' is the full path to the Linter distribution
(e.g. /usr/linter). To configure the pdo extension build, add --with-pdo-linter
as an option. Then execute make to run the build process and "make install"
to install the extension.

        Using driver as an internal php extension.

  A driver could be included into executable php file (or into php running as
an apache module). Building php from source is required in this case. Copy
driver source files and config.m4 in a separate directory "linter" or
"pdo_linter" inside the "ext" directory of the php source tree.
Then run "buildconf --force" to recreate the
'configure' file of php. After that two extra options (--with-linter and
--with-pdo-linter) will appear in configure. The usage of these options is
similar to that described in the phpize section.


                  Building and Using PHP

  In some cases, you may include the path to the Linter shared libraries 
directory (bin) in the LD_LIBRARY_PATH environment variable and use the 
dl command without editing the php.ini file.

  If you have PHP3 installed as an executable module, the dynamically 
downloadable extensions will not be available on some platforms (LInux, 
FreeBSD). To activate the downloadable extensions, reassemble PHP adding 
an option directing the linker to export all names of the module that is 
being assembled. For GNU ld utilized in FreeBSD and Linux, the 
-export-dynamic option or the -E option is used for this purpose. I.e., 
"-W1,-E" should be added to the line defining the LDFLAGS variable in 
the PHP source code makefile. After assembling and installing PHP 
according to the documentation and setting it up as described above, you 
may use the dl function for downloading the Linter interface.
You may as well mount PHP3 with a static Linter interface.
For this purpose:
1. Include the php3_linter.h file (from the php source code) in the 
internal_functions module. Add the {"Linter", linter_module_ptr} element 
to the php3_uiltin_modules structure array.
2. Add -I<LINTER_HOME>/intlib to the INCLUDE macro (Line 41 ?) in the 
root makefile. In the LIBS macro (Line 107 ?), add 
-L<LINTER_HOME>/intlib -lphp3_linter, where <LINTER_HOME> is the path to 
the Linter distributive tree.

    3.Give the "make -f makefile.dst" command.
If the mounting procedure has been correct, your PHP3 is ready to work 
with the DBMS Linter. In this case, you need not use the dl command to 
download the Linter interface, as the interface is always ready to use.

  If you are using Linter with an IPC version of intertask exchange, the 
interface will not work with PHP used as an Apache module. To find out 
what Linter version you are using, execute the linter-version command. 
If the version source code contains the "IPC" line, additional setup and 
remounting of Apache will be necessary. For this purpose, the following 
lines should be inserted before the last line of the src/include/httpd.h 
file of the Apache distributive containing "#endif":
#undef SIGUSR1
#define SIGUSR1 SIGHUP
Next, comment on the (case) selection related to SIGUSR1 in the 
src/main/http_main.c file, in the line where the compiler will detect an 
error. In other respects Apache is assembled and installed according to 
the documentation.


