Programming - - By Harry Fuecks

Client Side PHP in Internet Explorer

While messing with PHP 5.0.0 figured it’s finally time to take at Wez Furlongs Activescript SAPI for PHP. Will the madness never end? ;)

In brief Microsoft provide a mechanism in Windows to “embed” scripting engines (e.g. PHP) and thereby allow execution of code in other languages. More information can be found at MSDN on Windows Script Interfaces.

For PHP the best place for information is the extensive README.

Here’s a quick example which should probably work first time on Win 2000 / Win XP.

1. Download PHP 5 and unzip it somewhere (e.g. C:php-5.0.0 – you need to create this directory!)

2. From a command prompt;

C:> cd php-5.0.0
C:php-5.0.0> regsvr32 php5activescript.dll

That’s it. Now the fun begins.

Create a (plain HTML) web page like;

View the page in IE and away you go (you should see a list of objects you’d normally use from Javascript).

Now all we need is Microsoft to bundle it with IE ;)

Back to reality, where is actually might be useful is if you want to write Windows sysadmin scripts in PHP.

Update: when posting this thought it would be obvious that this is highly insecure. Make sure you read all the comments below before trying it.