Page 1 of 1

Help with creating a PHP extension

Posted: Thu Aug 28, 2003 11:53 am
by mikep
Hello all, this is my first post here, and pretty much the first time I'm aksing for help...

I have the source codes for a PHP extension which I downloaded off the net - it's available as C files, and the corresponding header files.

I've tried to follow the instructions for compiling the extensions manually - as indicated by the PHP manual online for creating extensions, with the source code of PHP at hand, within a Linux environment - but some errors are thrown up, such as compile process errors due to files not found, as indicated by includes within the header files mainly.

I'm no C/C++ expert, and compiling is new to me, so any help would be much appreciated...

The extension files are in http://frink.nuigalway.ie/~framework/Test/Free.zip as a zip. Please right hand click to Save Target As...

The article where the stat package came from: http://www.jstatsoft.org/v02/i01/statistics.pdf - the files were updated this year, though the article is very old. I've emailed the writer, but have yet to receive a reply after a few weeks... Oh well, he might be on holiday...

Posted: Thu Aug 28, 2003 6:45 pm
by BDKR
I would try google or the PHP-DEV list. But let me tell you up front: If you ask a question there, include the errors that you are getting!

Cheers,
BDKR

Posted: Thu Aug 28, 2003 10:10 pm
by volka
you might add the extension to the automated build.
After the php-sources are unpacked there is a directory called ext/
create a new directory statistics in there and copy the files from your archive to this directory. Then all you need is a config.m4 in this directory.
Probably

Code: Select all

dnl $Id$
dnl config.m4 for extension statistics

PHP_ARG_ENABLE(statistics, whether to enable statistics support,
ї  --enable-statistics Enable statistics support])

if test "$PHP_STATISTICS" != "no"; then
    PHP_NEW_EXTENSION(statistics, statistics.c com.c dcdflib.c ipmpar.c linpack.c randlib.c, $ext_shared)
    PHP_SUBST(STATISTICS_SHARED_LIBADD)
fi
will do (but I'm not sure, haven't tested it).
Go to the basedirectory of the php-source and run ./buildconf. If this works, run ./configure --enable-statistics=shared and make. Hopefully you will get a statistics.so you can use as extension-module.