Page 1 of 1
Using external library from PHP?
Posted: Sat Feb 03, 2007 8:44 am
by DarkSun24
Hey there,
I have a simple PHP script that gets an HTTP REQUEST and fetch it's content.
Now I want to do lot's of processing to this content, and I already have a C/C++ Library that does it, so I would rather avoid writing the same code in PHP.
Is there a way of using an external C library from PHP?
Many thanks!
Posted: Sat Feb 03, 2007 9:08 am
by feyd
What kind of library is it? I'm referring to the file itself, like a .lib, executable..
What sort of processing does it do?
Lib
Posted: Sat Feb 03, 2007 4:34 pm
by DarkSun24
Lib file, written in C.
It processes the received request buffer and generated a reply http buffer according to the request parameters + some library internal data.
Posted: Sat Feb 03, 2007 7:39 pm
by feyd
If memory serves, lib files must be compiled into an executable file such as a dll/so/exe. If you truly wish to not implement it in PHP (the most portable form) you will therefore need to build an extension around the lib (not so portable.)
Lib
Posted: Sat Feb 03, 2007 10:07 pm
by DarkSun24
And suppose I make the LIB an SO, can I use it from PHP? how?
Thanks!
Posted: Sat Feb 03, 2007 10:16 pm
by feyd
It's not as simple as making a .so, but interconnecting the functionality with PHP registered functionality that the extension adds.
Posted: Sun Feb 04, 2007 4:32 am
by volka
Take a look at
http://devzone.zend.com/node/view/id/1021
But
It processes the received request buffer and generated a reply http buffer
doesn't sound like you need a php extension but an apache/iis/webserver module.