Documentation:Reference:Php - MdsWiki
Navigation
Personal tools

From MdsWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:03, 31 December 2006 (edit)
WikiSysop (Talk | contribs)

← Previous diff
Current revision (18:37, 10 February 2017) (edit)
Jas (Talk | contribs)

 
Line 2: Line 2:
|- valign="top" |- valign="top"
| |
-To build the MDSPLUS PHP extension you should perform the following steps.+To build the MDSPLUS PHP extension you should perform the following steps. Beginning with downloading the sources.
- +{{:Software:DownloadSources}}
-1) Download the source distribution for PHP. (This extension has only been tested on PHP Version 4.3.7 on RHE Linux.)+== Steps ==
- +# 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.+# Create an mdsplus subdirectory in the ext directory of the PHP source kit.
- +# Copy the files in the mdsplus/php directory to this new mdsplus directory.
-3) Check out the mdsplus source from the MDSplus CVS repository:+# Configure the PHP build<br>In the top of the PHP source directory tree run the configure script using
- # cvs -d :pserver:MDSguest@www.mdsplus.org:/mdsplus/repos login+#: ./configure --with-mdsplus=/usr/local/mdsplus (or the directory where you have mdsplus installed)
- CVS password: MDSguest+#: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.
- # cvs -d :pserver:MDSguest@www.mdsplus.org:/mdsplus/repos checkout mdsplus+# Build and install php
-4) Copy the files in the mdsplus/php directory to this new mdsplus directory.+#: make
- +#: make install
-5) Configure the PHP build+# Try out the MDSplus php interface
- +
-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 &lt; PHP_SOURCE_DIR/ext/mdsplus/sample.php php &lt; PHP_SOURCE_DIR/ext/mdsplus/sample.php
If you want to just build a loadable module for php you can do the following: If you want to just build a loadable module for php you can do the following:

Current revision

To build the MDSPLUS PHP extension you should perform the following steps. Beginning with downloading the sources.

Download MDSplus sources

The MDSplus source code is maintained on github. If you are interested in building MDSplus from the sources we recommend downloading a tarball, or a zip file from there.

  1. choose 'stable' or 'alpha' - ""note alpha is the active development branch and may contain untested code.""
  2. choose 'zip' or 'tar.gz'
  3. download the sources (choose one of):
    wget https://github.com/MDSplus/mdsplus/archive/alpha.zip
    wget https://github.com/MDSplus/mdsplus/archive/alpha.tar.gz
    wget https://github.com/MDSplus/mdsplus/archive/stable.zip
    wget https://github.com/MDSplus/mdsplus/archive/stable.tar.gz

The MDSplus repository can also be cloned from github using:

git clone https://github.com/MDSplus/mdsplus.git

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. Copy the files in the mdsplus/php directory to this new mdsplus directory.
  4. 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.
  5. Build and install php
    make
    make install
  6. 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