Saturday, April 18, 2009

Visual Studio Web Developer Server and PHP

Today I've been looking for a solution that would allow me to serve PHP pages from my web application. Unfortunately it turns out there's no default handler for CGI applications. However Ziya Suzen has already created an IHttpHandler that does the job.

Remember: all the credits for this solution go to Ziya Suzen


PHP-Example.zip

Here you can find a complete solution that does just that: when executed from within Visual Web Developer it shows a list of files in a browser and when you select index.php you'll get a nice text "Hello, world!" that's being generated by PHP.

A few notes about the modifications I've made:

1. The php-cgi.exe executable has a fixed path build in. It's X:\programs\php\php-cgi.exe.
2. For some (yet) unknown reason the PHP script processor complains when the REQUEST_METHOD variable is set so I've commented it out.

Have fun!

No comments: