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
- wget <PHP Source Code>
- bunzip2 php-5.1.4.tar.bz2
- tar xf php-5.1.4.tar
- cd php-5.1.4
- PHP_INC=`pwd`
- export PHP_INC
- ./configure
- make
- cd <Datascope Source>
- source <Antelope Bash Script>
- sudo make install
- 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" ) ; }