PHP [Answered]RSS

5 replies

Last post Jul 09, 2010 03:19 PM by marioparris

  • PHP

    Jul 09, 2010 04:50 AM|Jeevecore|LINK

    Has anyone succeeded in getting PHP to work properly? It runs fine direct from localhost and IIS, but when I launch a page from Web Matrix I get a 404.3 error asking me to add a handler, which I know already exists. Also, be nice if you could delete a site. And if there's a physical file for the site configuration, it would be nice to be able to create a shortcut to launch it directly.
  • Re: PHP

    Jul 09, 2010 11:05 AM|marioparris|LINK

    So here's the fix. The IIS Developer Express Server is IIS 7. Which means it can be configured the same way. RTFM? So following the instructions here, we can add the PHP handler via the CLI. We don't need to add FastCGI since the Express server comes with it built in.

    But there's a catch, we need to change the paths. The configuration for the Express server is not in your WinDir, it is in the WebMatrix program files directory. So we need to change the path to the configuration utility and bada-bing bada-boom.

    So, here's a ready to go snippet, perfect for batch files. You will of course need to change the full path to your PHP runtimes.

    "C:\Program Files\Microsoft WebMatrix\appcmd.exe" set config /section:system.webServer/fastCGI /+[fullPath='C:\Library\PHP\php-5.3.1-nts\php-cgi.exe']
    "C:\Program Files\Microsoft WebMatrix\appcmd.exe" set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='C:\Library\PHP\php-5.3.1-nts\php-cgi.exe',resourceType='Unspecified']

     

  • Re: PHP

    Jul 09, 2010 01:33 PM|Jeevecore|LINK

    Cheers marioparris, Unfortunately, I'm still having no luck purely because I'm running x64 and Microsoft Web Platform Installer placed PHP in C:\Program Files (x86)\PHP. I've tried escaping the spaces and brackets using the caret, but I'm getting the error: Failed to process input: The parameter '(x86)\PHP\php-cgi.exe']' must begin with a / or - (HRESULT=80070057) Is there some other way of escaping this so that it doesn't consider it to be another parameter, or must I install PHP again somewhere else? Thanks for the help
  • Re: PHP

    Jul 09, 2010 02:08 PM|ruslany|LINK

    Jeevecore: the easiest workaround for this it to install any PHP application by using Webmatrix UI. When you do that the WebMatrix will properly register PHP with IIS Express (e.g. create the handler mapping).

  • Re: PHP

    Jul 09, 2010 02:34 PM|Jeevecore|LINK

    Ok, I've tried a few (Joomla, phpBB, Wordpress), uninstalling and reinstalling, trying again, and still to no avail. They all fail to create the databases, and still getting the same handler (or lack thereof) error.
  • Re: PHP

    Jul 09, 2010 03:19 PM|marioparris|LINK

    Initially I tried the method ruslany used, but that didn't work. It simply installed PHP 5.2 for my existing IIS 5.1, changing my original PHP setup, and not Web Matrix. And I needed PHP 5.3 :)

    If adding it via the command line is utitlity isn't working (silly spaces). I would simply move my PHP installation to a path without spaces :) Say C:\PHP. That's a pretty common setup, and then just change the path in the commands to C:\PHP\php-cgi.exe etc. 

     Also, you may want to uninstall the PHP which the Web Platform installer installed for you, and setup your PHP install manually using the zip archive. Or just using the MSI installer, being sure to set C:\PHP as the installation folder :). Just follow the instructions on the PHP manual for setting up PHP to work with FastCGI  and you should be good to go.

    Edit:

    Actually, you can just follow ruslany's instructions in the article I linked to previously: http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/#InstallPHP :) Just realised it's his article. Much thanks!