Microsoft has recently launched a beta release of a new project called WebMatrix. This is a complete web development stack that can be used to start developing and deploying web sites. One thing that may be not so obvious from all the existing announcements is the fact that WebMatrix has full support for installing, running and publishing PHP applications.
Here are the examples of how WebMatrix can be used to create and publish a PHP web site (using WordPress as a showcase).
Installing a PHP application
After installing and launching WebMatrix select “Site from Web Gallery” option and then pick WordPress:
Follow the installation steps as described in Download and Install a PHP application. As you proceed you will notice that WebMatrix downloads and installs the necessary components for running WordPress – the latest version of PHP 5.2 and MySQL. At the end of the installation process you will get a working instance of WordPress, that you can configure and customize further:
Notice the port number used in the URL. This is not the standard port 80 used by default in IIS. The site is not running on IIS that is included with operating system. Instead WebMatrix installs and uses IIS Developer Express, which is a developer-focused version of IIS that runs on all versions of Windows, starting from Windows XP. This is actually very cool because now it is possible to get the latest and greatest IIS features on Windows XP instead of using the good old IIS 5.1 as development web server :). But even if you already have Windows 7, you may still want to use IIS Developer Express, because with that you do not need to enable real IIS Web Server included with OS on your development machine.
Even though IIS Developer Express is a lightweight development server it comes with everything needed to run PHP applications, including the latest version of FastCGI module and URL Rewrite 2.0. This means that after you install WordPress with WebMatrix you can enable WordPress’ pretty permalinks by following the instructions at IIS URL Rewrite Module support in WordPress.
Note: By default WebMatrix and IIS Developer Express are not configured to run PHP even if PHP is already installed on the machine. To work this around install any PHP application via WebMatrix UI. This way WebMatrix will configure IIS Developer Express to handle PHP requests. This is something that will be fixed in future releases of WebMatrix.
Modifying a PHP application
After the WordPress is installed there are several things you can do with it from within WebMatrix. For example you can edit the theme files by using the built-in editor:
You can check what kind of HTTP requests are made by Web Browser to load a typical WordPress page:
(Learn more about this feature at Using WebMatrix Beta: Analyze Your WebSite)
Also, you can check the WordPress database content by using the WebMatrix Database Manager:
And, finally, you can run the search engine optimization analysis and fix any SEO violations found within the application:
(Learn more about this feature at Using WebMatrix Beta: Make your Website SEO Friendly)
Publishing a PHP application
The last step is the publishing of the web application on a live web server. WebMatrix can publish the content to a web server by using various protocols: FTP, FTP/SSL and WebDeploy (note that FTP protocols cannot be used to publish MySQL database). You can pick a hosting provider from the list offered by WebMatrix or you if you know the publishing settings from your hosting provider you can manually enter them in WebMatrix.
When you publish the content the WebMatrix will show you the list of files and the database that will be uploaded to the server. Note also that during publishing the WebMatrix will replace the current database connection settings in wp-config.phpfile with the connection settings used on a hosting web server. WebMatrix will extract that information from the connection string that you specify in publishing settings:
(Learn more about publishng web sites at Using WebMatrix Beta: Publish Your WebSite)
Feedback and suggestions
The WebMatrix is a beta release and the WebMatrix team is open to any constructive feedback on how to improve the product. Do you have any suggestions or have you run into any problems when using WebMatrix? What PHP related features would you like to see in this product? Please let the team know by starting the thread on WebMatrix forum or by leaving a comment here.
wonder how useful it is for keeping releases updated and current? as it is updating my wordpress not soo hard, updating drupal sometimes a nightmare….
@sn0n: The tool does not help with updating the PHP applications. It always has the latest version of a PHP app in the Web Gallery, but once you have install an app, it does not help with updating when newer version comes out.
i call shenanigans! jk.
so this is really more of a ‘local testing hobbyist’ tool then a full blown development ide? i just cant see much use myself unless it can push the latest version / updates for me.. guess i’ll have to tinker with it myself this eve..
you are right – this is not a full blown development ide. Here is the explaination of what is the purpose of this tool. The quote from the comments there:
“… You might find WebMatrix useful for quickly putting a blog on the web or doing lightweight scripting on the side. But it isn’t intended or focused on hard-core professional or enterprise development. It is instead aimed more for people looking to learn how to program and/or who want to get a site up and running on the web without having to write much code…”
What is the Server identifier of IIS Express? For example, IIS 7.5’s identifier is “Microsoft-IIS/7.5”.
Also, does any WordPress code that detects IIS need to be updated to detect IIS Express as well?
Hi Franklin. The server header returned by IIS Express is the same as for IIS 7.5:
Server: Microsoft-IIS/7.5\r\n
So I do not think it is necessary to change any WordPress code to detect IIS Express.
I am trying to use WEbMatrix to work on a php/mysql website and develop a shopping cart with Payflo-pro integration. Just downloaded it and had high hopes – too high I guess.
First, is it true that it installed WordPress with SQL Server express? I could not MYSQL database for WP metadata. I could not manage the MySQL server at all, could not connect to it and so stuff
I guess I will have to download a MYSQL client to manage that.
And now I am hearing it won;t help with publishing phph app?
Is there any other good phph/MySQL friendly IDE I can use?
Hi Silviu,
When you install WordPress, the WebMatrix is supposed to also install MySQL. After the installation is complete you should be able to find the MySQL section in the Windows Start menu. Also the WebMatrix can manage the MySQL database. Do you get any errors when you are tring to connect to MySQL from WebMatrix?
I suggest to give WebMatrix another try to see if you can get it to work with MySQL.
For more serious PHP/MySQL development you could try Eclipse Galileo and MySQL Administrator/Query Browser tools.
Any clues on how to set up web matrix to use an existing PHP installation? Everytime I try to install PHP using WebMatrix, it fails. I think our firewall is blocking sourceforge, which is where it is trying to install from.
Hi Chuck. The blog post by Brian Swan: Creating PHP Websites with WebMatrix contains informaiton that may help.
hi ruslany
iis7 and php i saw a error
php mysql command
mysql_real_escape_string and
mysql_num_rows
cant work
i try different sample but cant
Hi Mustafa, what is the PHP error that you are getting?
Hi Ruslany
I’ve been using XAMPP for local install but this looks fantastic!
Notice that you say…
“Notice the port number used in the URL. This is not the standard port 80 used by default in IIS. ”
XAMPP uses port 80 so presumably I could use both XAMPP and WebMatrix without any conflicts?
Thanks for the tutorial.
Hi Keith,
Yes, you should be able to use both XAMPP and WebMatrix on the same machine.
It’s a shame that it won’t be a fully blown IDE – it’s certainly the best looking application I’ve seen to edit files. I’m a PHP developer, and I’m currently using phpDesigner. I would have been looking forward to this more, if it became more of an IDE. Just one thing though, what’s the difference between this an Visual Web Developer? Is it that WebMatrix is more “user friendly”?
Anyway, congrats 🙂
Hi Shamil,
As far as I know the Visual Web Developer is an IDE for ASP.NET. It does not provide support for PHP. There is a Visual Studio plugin for PHP, but it is different from Visual Web Developer.
If comparing Visual Web Developer and WebMatrix for editing ASP.NET files then VWD is more advanced and powerful and is more suited for professional ASP.NET development. WebMatrix is much simpler and is targeted for beginner deverlopers.
Hi Ruslany,
Hi have installed wordpress on web matrix, when i try to start it, it shows this error ‘wordpress’ has stopped. it never starts, any help will be appreciated. P.S im on Win7
Hi. Web Matrix is a great help for writing C# code. Now we have the php as well. But does Web Matrix provide any kind of help for writing php code. An intellegencer or something like that?
Notice the port number used in the URL. This is not the standard port 80 used by default in IIS. The site is not running on IIS that is included with operating system. Instead WebMatrix installs and uses IIS Developer Express, which is a developer-focused version of IIS that runs on all versions of Windows, starting from Windows XP. This is actually very cool because now it is possible to get the latest and greatest IIS features on Windows XP instead of using the good old IIS 5.1 as development web server 🙂 . But even if you already have Windows 7, you may still want to use IIS Developer Express, because with that you do not need to enable real IIS Web Server included with OS on your development machine.
Even though IIS Developer Express is a lightweight development server it comes with everything needed to run PHP applications, including the latest version of FastCGI module and URL Rewrite 2.0. This means that after you install WordPress with WebMatrix you can enable WordPress’ pretty permalinks by following the instructions at IIS URL Rewrite Module support in WordPress.
Note: By default WebMatrix and IIS Developer Express are not configured to run PHP even if PHP is already installed on the machine. To work this around install any PHP application via WebMatrix UI. This way WebMatrix will configure IIS Developer Express to handle PHP requests. This is something that will be fixed in future releases of WebMatrix.
Hi there, i want to write php scripts using webmatrix2 but i’am Unable to install blank php template on webmatrix2 . The error which is shown is as follows:
enable fast.cgi or other cgi for php….
I’ve done that, but still the problem persists…