| WeOnlyDo! COM Web Server ActiveX - Setting up PHP to run as ISAPI extension |
| ® WeOnlyDo! COM (2002-2004) |
|
General information This tutorial will show step by step how to setup PHP to work with wodWebServer, running as loaded ISAPI extension. It assumes you have installed wodWebServer to your local folder, and tested it so it works with provided samples. Step 1 - installing PHP You should download PHP installation from http://www.php.net, and install it
into C:\PHP folder. PHP.EXE should exist in that
folder. Copy PHP4TS.DLL (PHP5TS.DLL in PHP5) file from C:\PHP to C:\WINDOWS\SYSTEM32 for PHP to operate correctly! If you get an error 'ISAPI Extension file could not be loaded' and you are 100% sure you followed above steps, then most probably this is directory/path issue. For start, try to move your code to C:\PHP folder and execute it from there (just for a test).
Step 2 - using PHP from VB (similar approach is needed for any other language) Fire up new VB project, and add wodWebServer to it. Start it so it listens and accepts incoming connections. Typically, code will look like this
Now server will accept connections, but will not know what to do with PHP requests. So, we need to load appropriate PHP ISAPI extension, like this:
It is important to set DocumentRoot property because many ISAPI extensions will need proper mapping information - how to resolve requested URI to a file on disk. When PHP request arrives from the client, we need to process it. The most convenient place to so that is RequestDone event, so you can do this:
Above code is self-explanatory. It calls our ISAPI with two arguments: requested path, and resolved path of the script. Conslusion That should be it! If you point your browser to local
instance of wodWebServer, you will see PHP running there. |