Display PHP errors in Webmatrix

WebMatrix 2 - logoFor several weeks Microsofts development environment, called WebMatrix, is available in version 3. As already the first and second version was, WebMatrix 3 is ​​a free development environment for websites and web applications of different platforms such as ASP.NET, PHP, and HTML5.

I use WebMatrix from time to time to test, among other things, just one or the other PHP script. Sadly the provided/integrated web server shows by the default settings, so as it is delivered, no PHP error messages. So when the gremlins sneak in your PHP script and you have not caught all code in try-catch blocks, you only see a white page in browser. For productive environments this seems to make sense, but for a development tool, this is plain and simple said – bullshit!

To show the, in my opinion very helpful, error messages again the php.ini needs to be adjusted. If didn’t changed anything during the setup of WebMatrix, an IIS Express server runs under the hood of WebMatrix. The php.ini file can be found on Windows 7/Windows 8 by default in the following path:

C:\Program Files (x86)\IIS Express\PHP\v5.3

(Maybe your version of PHP (here 5.3) can be different.)

Now open the php.ini file and search for the following line:

display_errors = Off

If you want to show error messages, then you only have to replace the „off“ by an „on“.

display_errors = On

After saving the php.ini, from now on PHP should return/show all error messages.

If there are problems when saving, then this is in most cases a permissions problem. You can remedy yourself by starting Notepad as an administrator by right-clicking and then using the „File – Open“ feature of Notepad to open the php.ini. So it should work in any case.

I hope you enjoy developing with PHP in Webmatrix!

Leave a comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked