Re: Using php in custom built http server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 19, 2008 at 5:58 PM, Mr. Gecko <grmrgecko@xxxxxxxxx> wrote:

> Hey, I built my own http server, and I'm wanting to add php to it. the
> server is in Objective-C.
> I know I can use terminal commands to do it, but if I was to do that how
> would I get headers and stuff php sends, and how would I send php
> HTTP_REMOTE_ADDRESS and stuff like that?


there is a well known book, by sara golemon, extending & embedding
php<http://tinyurl.com/a75bbk>.
youll almost certainly want to grab that.  there are also some nice pdf's
and articles online, mostly for writing extensions afaict.  only a small
portion of the book about embedding php, but to give you a quick overview,
the most simple approach to embedding essentially boils down to including
libphp, and invoking it with a string of php & the C level eval().  the book
will get you going from there.

im sure if you know what youre doing, which if you could write a webserver
in objc, i suppose you would, should be able to get the eval-based approach
working 'pretty quickly'TM.  from there you can experiment w/ the info the
book has and it would probly be good to find some smaller webserver projects
that support php, like lighttpd <http://www.lighttpd.net/download>.
lighttpd is stricly C tho, if im not mistaken, but im sure youll find some
nice example segments there.

I would prefer doing it with terminal commands, but I am willing it do it
> with a library or however I have to do it.
>

well, im not sure what you need to do, make-file-wise, to get C to compile
into an objective-C application, but i know it can be done, b/c i did it on
an iphone app where we used the C interface to sqlite3.  im sure if youre
webserver is using objective-C classes, and some of its neat runtime
features, you might wind up writing some sort of OO wrapper around phps
embedding api, but thats just a guess.

btw, is this a private project or is the code out there somewhere ?

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux