Wednesday, July 7, 2010

WebMatrix PHP Editor

Yesterday Scott Guthrie announced WebMatrix, a new tool from Microsoft which lowers the barriers to entry for creating your own .NET based website. It features all the newest Microsft treats which Guthrie has introduced over the last week: IIS Express, Compact SQL Server, and Razor.

Tonight, rather than playing with all these new toys, I was able to setup WebMatrix as an IDE for an existing PHP website I manage. A screenshot (clicky, please):



It's pretty, by far the best looking PHP IDE I've tried. And easy to use; everything about it screams simplicity (which is good and bad: no intellisense, no right-click context menu). Still a huge improvement over my previous editor: Filezilla and TextPad :)

Two big complaints: the Publish functionality wasn't working well for me (I update to an ftp site, WebMatrix updates *all* files everytime) and my site doesn't render perfectly in the browser (css-related stuff, not sure if it's an IIS Express).

I did have to go through a bit of pain to get IIS Express to render php pages. Detailed issue below:
  • Trying to load a .php page, I recieved a HTTP 404.3 error: "The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map."
  • The handler is not present! I spent quite a bit of time trying to manually update the .config file (I think I was updating the wrong one - %WebMatrixInstall%/config/applicationHost.config?? Anybody know?) before finding this post which details how to add a php handler to IIS 7.0 and IIS 7.5 (and IIS Express, which is based on IIS 7.5) via appcmd.exe.

And how to fix it:

  • Open a command prompt at your WebMatrix install directory (mine is "C:\Program Files (x86)\Microsoft WebMatrix"
  • For the following command, replace the scriptProcessor parameter with your proper path to php-cgi.exe and run: " appcmd set config /section:handlers /+"[name='PHP_via_FastCGI',scriptProcessor='C:\Program Files (x86)\PHP\php-cgi.exe',path='*.php',verb='*',modules='FastCgiModule',resourceType='Either']" "
  • Do the same with this command: " appcmd set config -section:system.web
    Server/fastCgi /+"[fullpath='C:\Program Files (x86)\PHP\php-cgi.exe']" /commit:a
    pphost "
  • It works (for me)!

All in all, I was very impressed with WebMatrix and IIS Express. I'll be using WebMatrix to manage my PHP site in the future and I hope to play with Razor and SQL Express soon!

8 comments:

  1. Have you tried PhpStorm? http://www.jetbrains.com/phpstorm/index.html

    ReplyDelete
  2. Hi. I've just instaled WebMatrix and I want to php running, but I can't find appcmd.exe. My folder c:\windows\system32\inetsrv is empty and I can't google it. Please help me :)

    ReplyDelete
  3. different then expected. see the title tag -
    "programing nightmare: webmatrix php editor"

    ReplyDelete
  4. Hi,Many publishers will ask a prospective client about the platform. In other words, If we publish a book, what sort of a reader base do i already have that we can count on to buy the new publication in Web Design Cochin. Fairly weighty request, wouldn't you say. For now, let's concentrate on the website part. A writers website would include a biography, a catalog of published books and works, perhaps excerpts from some works, Thanks.....

    ReplyDelete
  5. I use and suggest Codelobster.
    It is free, it works fast and smart.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. It will further be too easy for the students to understand in detail all those evident principles mostly considered so evident. linear programming help

    ReplyDelete