cat brain.log | less

Getting it down on `paper`

Compiling Datascope.so for PHP

Does the following sentence make sense?

In order to be able to simply dl(“Datascope.so”) in your PHP code, you first need to make sure Datascope.so is compiled and copied to the extension_dir, as specified in php.ini (ex: /usr/lib/php4).

Answer:
No: Stop right now. You’re not qualified to read this article.
Yes: Keep reading.

Notes

You’re not compiling the PHP source code for actual use, so please don’t install it. If you do, you run the risk of clobbering any pre-existing php installations, and overwriting previously compiled-in modules. The only reason why you ”make” PHP is so that the Zend libraries are properly initialized.

The PHP ”make” step may be avoidable, but given that the compile doesn’t affect system performance, I didn’t bother.

Paths should be changed to reflect your setup. If you don’t have the src/contrib/data/php/datascope code, you can get it from the contrib source at BRTT‘s web site.

Contrib appears to be maintained by Indiana University.

Paths

  • Antelope Bash Script ”/opt/antelope/4.9/setup.sh”
  • Datascope Source ”/opt/antelope/4.9/src/contrib/data/php/datascope”
  • PHP Source Code URL ”http://downloads.php.net/ilia/php-5.1.4.tar.bz2”
  • PHP Modules Directory ”/usr/lib/php/modules/”

Compile and Install Steps

  1. wget <PHP Source Code>
  2. bunzip2 php-5.1.4.tar.bz2
  3. tar xf php-5.1.4.tar
  4. cd php-5.1.4
  5. PHP_INC=`pwd`
  6. export PHP_INC
  7. ./configure
  8. make
  9. cd <Datascope Source>
  10. source <Antelope Bash Script>
  11. sudo make install
  12. sudo cp Datascope.so <PHP Modules Directory>

PHP Script Example

Proper usage of the ”Datascope.so” module follows:

putenv( "PFPATH=/opt/antelope/4.9/data/pf" );
putenv( "ANTELOPE=/opt/antelope/4.9" );
 
set_include_path(
  get_include_path().PATH_SEPARATOR.getenv('ANTELOPE')."/data/php"
);
 
 
if( !extension_loaded( "Datascope.so" ) ) {
  dl( "Datascope.so") || exit( "Failed to load datascope.so" ) ;
}
 

Comments

No comments so far.

You must be logged in to post a comment.