php .NET and ANSI C
Moderator: General Moderators
php .NET and ANSI C
I am a newbie and a so-so .NET developer converting to php. Please bear with me.
I've finished a .NET version of The Link Grammar, an English syntax parser, now my new assignment is implement a php version of it. What I have is a set of APIs written in ANSI C.
Question is how do I make these APIs php callable.
My knowledge about server is very minimal so here I speculate. The APIs needed to be compiled, installed in some cgi directory, make them php-bound. Am I heading right direction?
I've finished a .NET version of The Link Grammar, an English syntax parser, now my new assignment is implement a php version of it. What I have is a set of APIs written in ANSI C.
Question is how do I make these APIs php callable.
My knowledge about server is very minimal so here I speculate. The APIs needed to be compiled, installed in some cgi directory, make them php-bound. Am I heading right direction?
I think the easiest (most portable) way is to make them available via a php extension.. http://www.zend.com/php/internals/exten ... iting1.php...
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Yeah, what little C I've done was written 5 years ago so I'm rusty myself. Definatly would come in handy for server intensive operations. The JSON parser extension is something like 5900% faster than a PHP implementation. For this reason I created a driver system that acts as an abstraction layer for functionality like this. For example I could have a json driver that uses a php implementation, or I could have a json driver that uses the extension.Everah wrote:That is a great tutorial. Makes me want to go out and learn C so I can write an extension.
And to plug this while I'm at it, the project I mention is hosted on google's project hosting here: http://code.google.com/p/webtpo/
Check it out every so often.
Hi timvw,
Thanks for the clue. I am studying it. I tried to reach you at timvw@users.sourceforge.net but got an error: "... This is a permanent error; I've given up. Sorry it didn't work out."
Thanks for the clue. I am studying it. I tried to reach you at timvw@users.sourceforge.net but got an error: "... This is a permanent error; I've given up. Sorry it didn't work out."
Weirdan:
Please allow me to be candid and with my humility, here is the error email:
Please allow me to be candid and with my humility, here is the error email:
I was thinking the solution is original, and I was asking him to help with a nominal fee.Hi Tim,
=20
You have answered my posts about the Link Grammar. I would not dare to =
hire you to do my job. This is my own research for my Vietnamese parser, =
no commercial value. But would you please help me for a nominal fee. =
Let=E2=80=99s say =E2=80=A6 [ngungo edited]. And what you make would be public =
domain as well.
=20
I don=E2=80=99t need it right away, do it in your spare time.
=20
Respectfully,
ngungo
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
C and PHP are way complete different...
I'll note some key differences, instead of just syaing there different...
C is a complex "compiled" language, getting code to complie without errors on anything but trivial applications can be tricky, not to mention cross platform tests, etc...
On large applications you will encounter namespace collisions, which is partly why C++ was introduced...
Compiler and linker errors, depending on compiler aren't very clear, it's years of experience which let you discover and correct bugs properly not a few weeks reading C.
C is vastly more powerful and flexible. You can program complete OS's (minus a bit of ASM) device drivers, COM components, applications, etc...
PHP is limited to basically web applications, which it does excellently, which is why I use it instead of C (which is how I started programming server side scripts in).
C requires understanding of advanced memeory techniques....
Whats the difference between a heap or a stack? In PHP it's ZE memory allocaiton routines and garbage collection take care of this for you...
Do you have the diligence to check every pointer? Cause a bad pointer in C will almost always be a bad thing...
What's the difference between a pointer and a reference?
You want to include a third pary library, but are only given an *.lib file, where do you start?
Programming a GUI in straight C is killer...it's why frameworks like MFC, OWL, wxWidgets, etc were introduced...
The point is, C is a massively more complex language than PHP, PHP is a *very* high level language whereas C is often refered to a low level language...as in you have more direct contorl over a computer, second only to ASM...
I should have read more, but how did this even start? Such a silly disscussion...as clearly anyone who is competent in C would agree it's much more difficult than PHP...
Especially for building applications...
Fibonacci number sequence generators you program in Collage, etc...are only scraping the roof of the basics...so they don't count and it doesn't qualify you as a C developer...
I'll note some key differences, instead of just syaing there different...
C is a complex "compiled" language, getting code to complie without errors on anything but trivial applications can be tricky, not to mention cross platform tests, etc...
On large applications you will encounter namespace collisions, which is partly why C++ was introduced...
Compiler and linker errors, depending on compiler aren't very clear, it's years of experience which let you discover and correct bugs properly not a few weeks reading C.
C is vastly more powerful and flexible. You can program complete OS's (minus a bit of ASM) device drivers, COM components, applications, etc...
PHP is limited to basically web applications, which it does excellently, which is why I use it instead of C (which is how I started programming server side scripts in).
C requires understanding of advanced memeory techniques....
Whats the difference between a heap or a stack? In PHP it's ZE memory allocaiton routines and garbage collection take care of this for you...
Do you have the diligence to check every pointer? Cause a bad pointer in C will almost always be a bad thing...
What's the difference between a pointer and a reference?
You want to include a third pary library, but are only given an *.lib file, where do you start?
Programming a GUI in straight C is killer...it's why frameworks like MFC, OWL, wxWidgets, etc were introduced...
The point is, C is a massively more complex language than PHP, PHP is a *very* high level language whereas C is often refered to a low level language...as in you have more direct contorl over a computer, second only to ASM...
I should have read more, but how did this even start? Such a silly disscussion...as clearly anyone who is competent in C would agree it's much more difficult than PHP...
Especially for building applications...
Fibonacci number sequence generators you program in Collage, etc...are only scraping the roof of the basics...so they don't count and it doesn't qualify you as a C developer...
Hi Tim,timvw wrote:I think the easiest (most portable) way is to make them available via a php extension.. http://www.zend.com/php/internals/exten ... iting1.php...
I just received your message through paypal. My brief reply is NO, I haven't got my problem solved. Since then I searched and read more about php extension, bought this book and read through but unable to make sense out of it. Sorry me, huh!
I really need help but I also know that is all you can help. I appreciate.
ngungo