To build the MDSPLUS PHP extension you should perform the following steps.
1) Download the source distribution for PHP. (This extension has only been tested on PHP Version 4.3.7 on RHE Linux.)
2) Create an mdsplus subdirectory in the ext directory of the PHP source kit.
3) Check out the mdsplus source from the MDSplus CVS repository:
# cvs -d :pserver:MDSguest@www.mdsplus.org:/mdsplus/repos login CVS password: MDSguest # cvs -d :pserver:MDSguest@www.mdsplus.org:/mdsplus/repos checkout mdsplus
4) Copy the files in the mdsplus/php directory to this new mdsplus directory.
5) Configure the PHP build
In the top of the PHP source directory tree run the configure script using
./configure --with-mdsplus=/usr/local/mdsplus (or the directory where you have mdsplus installed)
Note: You may want to use additional configure options to build additional modules as needed or to add the new php into your apache server.
6) Build and install php
make make install
7) Try out the MDSplus php interface
php < PHP_SOURCE_DIR/ext/mdsplus/sample.php
If you want to just build a loadable module for php you can do the following:
cd PHP_SOURCE_DIR/ext/mdsplus ./build.sh
This should produce a mdsplus_php.so loadable module. You would use the dl() function to load this module. Note the location that the dl() function uses to find loadable modules is set in the php.ini configuration file. This may, by default, be set to "./" which would require the module to be located in the same directory as the php script being executed.
Another method is to use the phpize program which is often distributed with php. To use this method do the following commands:
$ cd mdsplus/php (This is the php directory under the mdsplus source tree) $ phpize $ ./configure $ make
This will produce a modules/mdsplus.so file which you can copy to mdsplus_php.so in your php library directory.
There are several sample php cgi scripts found in the php subdirectory of the mdsplus source tree:
sample.php - shows most of the use and functionality of the php interface. shot_display.php - displays plots of mdsplus signals. browser.php - a simple mdsplus tree browser