PHP's great claim to fame has always been a solution to a domain specific problem, Delivering Web pages. It's relatively easy mixing of HTML and code (while at times very nasty), have proved quite a good solution for many people.
But as technolgy moves forward, I wonder if PHP will be required much longer. Why you may ask, since I've got craploads of PHP code lying around in my subversion folders. Well In addition to most of my new projects using ExtJS to deliver the interfaces, which has almost totally removed PHP from rendering tasks. The last few weeks I have been using Mysql's newish Stored procedures, which move the alot of application logic and rules into the database, and seriously reduce rather kludgy code in PHP. Not only that it also reduces the data going back and forth between PHP and Mysql.
So PHP is doing less and less of the work, to the point where if there was an apache module that did mysql stored procedure calls based on the request URL, and returned JSON, I suspect PHP would be practically obsolite.....
Anyway started playing with apache modules today... - not enough time to do anything substantial, but there are a few fixes needed to this page.
http://www.ibm.com/developerworks/linux/library/l-apache/The build lines should be something like this.
gcc -fPIC `apxs2 -q CFLAGS ` -I`apxs2 -q INCLUDEDIR`
-c time_cookie.c -o time_cookie.o
gcc -shared -lapr-1 -laprutil-1 time_cookie.o -o time_cookie.so
And the FOREACH loop in it should use
curr_bucket = APR_BRIGADE_FIRST(bb);
while (curr_bucket != APR_BRIGADE_SENTINEL(bb)) {
...
curr_bucket = APR_BUCKET_NEXT(curr_bucket);
}
Anyway I wonder if anyone has done a Mysql/Json apache module.