The Glass is Too Big - Home

PHP In Browser Update

Originally published on: 7/19/2004 7:53:19 AM

Well, with the release of PHP5 (and yes, Sokkit 4.0 will be based on

PHP5), it appears that Wes Furlong (spelling?) has fixed the issues with

the ActivePHP extension/container. The ActivePHP5 container now can access

the document, window, history, etc. objects for the browser, including

$window->alert() and $document->write(). The first few attempts at

manipulating the DOM tree didn't seem to want to work and those browser

objects don't dump their structure with print_r() like the other $GLOBALS

variables do. I found that strange. If you do a print_r($GLOBALS,true) in

the ActivePHP5 container, you get exactly what you'd expect for the

environment variables, etc. However, when it gets down to the $document,

$window, etc. objects, all you get is the top level for 95% of them and a

single property for the rest. However, clearly, there is more inside of

those objects than that. Obviously, I don't expect to see methods, but I

did expect to be able to see properties. Unfortunately, this means that

much of the work to do development with this will require hunt-and-peck

debugging to see how to get things like inserting content into a given id

will work.



Also disappointing is that building WSC's doesn't seem to work. I used the

Microsoft wizard and "ActivePHP5" as my engine to build a basic WSC. I

then called it from a test PHP script using the COM interface. I was able

to load the object without PHP calling my die() routine, but when I try to

access a property or method of my WSC, PHP crashes. This may be to some

residual PHP4 files on my test machine. Incidentally, if you want to use

ActivePHP5 on your machine, you need to pretty much commit to PHP5 as it

will use your php.ini file from your Windows/System directory and will try

to load any extensions you have in there, which will mismatch API's with

PHP5. Just an FYI for anyone wondering what's going on when they try this.



At any rate, if anyone has a working WSC, I'd love to see it. Why? Because

writing WSC's with PHP means you can build COM objects *out of* PHP and

use them in *other* COM enabled languages like ASP. Given the fact that so

many COM components for ASP use are really expensive, a cheap PHP COM

object could be a real alternative way to infiltrate ASP development with

the built-in wizardry of PHP.

Comments

blog comments powered by Disqus
© 2003- 2010 J Wynia. Very Few Rights Reserved.