Help with creating a PHP extension

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikep
Forum Newbie
Posts: 1
Joined: Thu Aug 28, 2003 11:53 am

Help with creating a PHP extension

Post 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...
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
Post Reply