<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0"><channel><title>RuslanY Blog</title><link>http://ruslany.net</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RuslanyBlog" /><description>Windows Azure, IIS, PHP and other interesting stuff</description><language>en-US</language><lastBuildDate>Wed, 20 Mar 2013 11:02:06 PDT</lastBuildDate><generator>http://wordpress.org/?v=3.4.2</generator><sy:updatePeriod xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">hourly</sy:updatePeriod><sy:updateFrequency xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">1</sy:updateFrequency><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RuslanyBlog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="ruslanyblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Azure Web Sites – WordPress plugin update bug fixed</title><link>http://ruslany.net/2013/03/azure-web-sites-wordpress-plugin-update-bug-fixed/</link><category>PHP</category><category>WAWS</category><category>WinCache</category><category>WordPress</category><category>Windows Azure</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Wed, 20 Mar 2013 11:02:06 PDT</pubDate><guid isPermaLink="false">http://ruslany.net/?p=3021</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>Windows Azure Web Sites has recently been upgraded to a new version. Among all the improvements and bug fixes in the new version there is one change that fixes a <a href="http://ruslany.net/2011/04/wincache-and-wordpress-plugin-upgrade-problem/">known issue with update of WordPress plugins</a>. There have been numerous questions about this problem at the Azure Web Sites <a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazurewebsitespreview/thread/8c4d17e9-520c-4d89-bc7d-efe923dd1a55">forum</a>.<span id="more-3021"></span></p>
<p>After the service upgrade the Windows Azure Web Sites now uses a newer version of WinCache &#8211; <strong>1.3.4</strong>. This version has a fix for for the plugin update problem. I tried it and was able to update all of plugins on my site without a problem:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/03/PluginUpgrade.png"><img class="alignnone size-medium wp-image-3031 screenshot" title="PluginUpgrade" src="http://ruslany.net/wp-content/uploads/2013/03/PluginUpgrade-500x375.png" alt="Plugin Upgrade Works" width="500" height="375" /></a></p>
<p>Other PHP related changes in this release of WAWS include newer PHP version (<strong>5.3.19</strong>) and support for <a href="http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configuring-the-fastcgi-extension-for-iis-60">UTF-8 encoding for server variables REQUEST_URI and PATH_INFO</a>.</p>
]]></content:encoded><description>Windows Azure Web Sites has recently been upgraded to a new version. Among all the improvements and bug fixes in the new version there is one change that fixes a known issue with update of WordPress plugins. There have been numerous questions about this problem at the Azure Web Sites forum. After the service upgrade the Windows [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2013/03/azure-web-sites-wordpress-plugin-update-bug-fixed/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments></item><item><title>PHP Troubleshooting in Windows Azure Web Sites</title><link>http://ruslany.net/2013/01/php-troubleshooting-in-windows-azure-web-sites/</link><category>PHP</category><category>WAWS</category><category>Windows Azure</category><category>Xdebug</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Wed, 30 Jan 2013 11:26:09 PST</pubDate><guid isPermaLink="false">http://ruslany.net/?p=2381</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>The need to diagnose and troubleshoot application&#8217;s failures often comes up during deployment to a hosting environment. Some configuration settings in hosting server may differ from what application expects. Often it is not as easy to figure out the cause of the problem in a hosting environment as it is on a development machine.  I found the following techniques useful when troubleshooting errors in PHP applications hosted in Windows Azure Web Sites.</p>
<h3>1. phpinfo()</h3>
<p>This is the most obvious, but very often the most helpful diagnostics tool. The output of this function provides a lot of information about the PHP runtime. Use it to determine what PHP extensions are enabled, what are the PHP configuration settings and what values are stored in server environment variables.<span id="more-2381"></span></p>
<p>To use the phpinfo() function create a new php file that contains just one line:</p>
<pre name="code" class="php">
&lt;?php phpinfo(); ?&gt;
</pre>
<p>Name this file with some non-obvious name (don&#8217;t name it phpinfo.php) and upload it to the root directory of your site. Request this file from a web browser and analyze the output.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag1.png"><img class="alignnone size-medium wp-image-2531 screenshot" title="phpinfo() output" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag1-500x420.png" alt="" width="500" height="420" /></a></p>
<blockquote><p><strong>The output from phpinfo may expose security sensitive information! Always delete this file from the site&#8217;s root directory after you are done with it.</strong></p></blockquote>
<h3>2. wincache.php</h3>
<p>WinCache extension is by default enabled for PHP web sites. To check how opcode and user cache work and what is the current content of the cache use <strong>wincache.php</strong> script that can be downloaded from the <a href="http://svn.php.net/viewvc/pecl/wincache/tags/1.1.0stable/wincache.php?view=co">wincache source code repository</a>. Get the script and the edit it by specifying the user name and password that will be used to protect the access.</p>
<pre name="code" class="php">

/**  * ======================== CONFIGURATION SETTINGS ==============================
* If you do not want to use authentication for this page, set USE_AUTHENTICATION to 0.
* If you use authentication then replace the default password.
*/
define(&#039;USE_AUTHENTICATION&#039;, 1);
define(&#039;USERNAME&#039;, &#039;someusername&#039;);
define(&#039;PASSWORD&#039;, &#039;somepassword&#039;);

</pre>
<p>After that upload it to the root directory of a website and request this page from a web browser. The output will look similar to below:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag2.png"><img class="alignnone size-medium wp-image-2581 screenshot" title="wincache.php output" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag2-500x393.png" alt="" width="500" height="393" /></a></p>
<p>Always protect the <strong>wincache.php</strong>script by using the built-in authentication or other authentication mechanisms. Leaving this script unprotected may compromise the security of your web application.</p>
<h3>3. PHP Error Log</h3>
<p>PHP runtime in Windows Azure is configured to save application errors into a log file located in the /<strong>LogFiles</strong> directory under FTP root of a site.</p>
<p>If application does not work or returns a blank page &#8211; check this file as it may contain the details of an error. I also check this file from time to time for my live sites to make sure the site is running properly.</p>
<p>It is also possible to overwrite the default location of the error log file. For that create a file called <strong>.user.ini</strong> and add the following line to it:</p>
<pre name="code" class="dos">

error_log=D:\Home\site\wwwroot\php_errors.log

</pre>
<p>Upload this file to the root directory (wwwroot) of your web site.</p>
<h3>4. PHP display_errors</h3>
<p>PHP runtime directive <a href="http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors">display_errors </a>is used to output the errors in the HTTP response. For production deployments it should be set to &#8220;Off&#8221; in order to not show error details to web site visitors. For development and debugging purposes you can temporary set it to On by using .user.ini file:</p>
<pre name="code" class="dos">

display_errors=On
html_errors=On
error_reporting = E_ALL

</pre>
<p>When application has an error it will be output in the web browser.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag5.png"><img class="alignnone size-medium wp-image-2591 screenshot" title="display_errors output" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag5-500x151.png" alt="" width="500" height="151" /></a></p>
<p>I usually turn display_errors off as soon as I got all the necessary information from the error output.</p>
<h3>5. HTTP logs, Detailed Error Messages, Failed Request Tracing</h3>
<p>By default HTTP logging, detailed error messages and failed request tracing are turned off for a site. To turn them on use the CONFIGURE page in Windows Azure Portal:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag4.png"><img class="alignnone size-full wp-image-2601 screenshot" title="Turn on diagnostics settings" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag4.png" alt="" width="373" height="335" /></a></p>
<p>Once enabled the log files will appear in the following directories under site&#8217;s FTP root:</p>
<ul>
<li> HTTP log files will appear in the <strong>/LogFiles/http/RawLogs</strong>;</li>
<li>Detailed errors will appear in the <strong>/LogFiles/DetailedErrors</strong>;</li>
<li>Failed Request Tracing logs will be in <strong>/LogFiles/W3SVC#########/</strong>;</li>
</ul>
<h3>6. XDebug PHP Extension</h3>
<p><a href="http://xdebug.org/">Xdebug</a> is a very popular PHP extension that helps with debugging and profiling of PHP scripts by providing a lot of valuable debug information. To enable Xdebug for a site in Windows Azure download the appropriate build of Xdebug extension from <a href="http://xdebug.org/download.php">downloads page</a>. If your site uses PHP 5.3 then download “<em>5.3 VC9 (32 bit)</em>”. If your site uses PHP 5.4 then download “<em>5.4 VC9 (32 bit)</em>”. <strong>Use 32 bit build even if your Windows OS is 64 bit</strong>. <strong>Do not use thread safe (TS) builds</strong>.</p>
<p>Upload the php_xdebug_####.dll file to <strong>/site/wwwroot/bin </strong>directory. If bin directory does not exist then create it. After that use the CONFIGURE tab in Windows Azure Portal to enable xdebug extension:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag7.png"><img class="alignnone size-medium wp-image-2611 screenshot" title="Enable XDebug" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag7-500x131.png" alt="" width="500" height="131" /></a></p>
<p>With xdebug enabled you will be getting more detailed error messages and call stack:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag6.png"><img class="alignnone size-medium wp-image-2621 screenshot" title="XDebug output" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag6-500x160.png" alt="" width="500" height="160" /></a></p>
<h3>7. ClearDB stats</h3>
<p>ClearDB service that provides MySQL database hosting is now integrated into the Windows Azure Portal. It is now possible to buy and manage your MySql databases from the portal. Also the billing is integrated, meaning that ClearDB charges will be billed on Azure subscription.</p>
<p>To access ClearDB management page use the ADD-ONS tab.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag8.png"><img class="alignnone size-full wp-image-2631 screenshot" title="ClearDB add-on" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag8.png" alt="" width="257" height="491" /></a></p>
<p>From there you can open the ClearDB query performance page as well as access other database management information</p>
<p><a href="http://ruslany.net/wp-content/uploads/2013/01/phpdiag9.png"><img class="alignnone size-medium wp-image-2641 screenshot" title="ClearDB performance" src="http://ruslany.net/wp-content/uploads/2013/01/phpdiag9-500x331.png" alt="" width="500" height="331" /></a></p>
<p>I wonder why the query performance chart shows such a light load on my database. I guess this maybe because of a wincache user cache which loads all the blog content in memory so there are very few or none database access operations.</p>
]]></content:encoded><description>The need to diagnose and troubleshoot application&amp;#8217;s failures often comes up during deployment to a hosting environment. Some configuration settings in hosting server may differ from what application expects. Often it is not as easy to figure out the cause of the problem in a hosting environment as it is on a development machine.  I found the following techniques useful when [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2013/01/php-troubleshooting-in-windows-azure-web-sites/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments></item><item><title>phpMyAdmin on Windows Azure Web Sites</title><link>http://ruslany.net/2012/12/phpmyadmin-on-windows-azure-web-sites/</link><category>PHP</category><category>WAWS</category><category>Windows Azure</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Mon, 17 Dec 2012 09:48:47 PST</pubDate><guid isPermaLink="false">http://ruslany.net/?p=1791</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>In my previous post about the migration of a WordPress site to Windows Azure I mentioned that I used phpMyAdmin to import existing blog data into a MySql/ClearDb database in Windows Azure. phpMyAdmin is a web based tool for administering MySql databases. It can be used to create tables, edit the data in tables, export/import/backup data and many other tasks. I found it to be an adequate tool for all MySql db administration needs in Windows Azure. This post describes how to install and configure phpMyAdmin on Windows Azure Web Sites.<span id="more-1791"></span></p>
<h2>1. Create an empty site</h2>
<p>First you&#8217;ll need to create a new site in Windows Azure. 10 free sites are allowed per subscription and phpMyAdmin will work fine on a free site. Create an empty site using &#8220;Quick Create&#8221; option in Windows Azure Portal:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_1.png"><img class="alignnone size-medium wp-image-2051 screenshot" title="Quick Create Site" src="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_1-500x398.png" alt="" width="500" height="398" /></a></p>
<h2>2. Link the site with a MySql database</h2>
<p>If you already have a MySql database or need to create one then use the Linked Resources page to link that database with your site.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_2.png"><img class="alignnone size-medium wp-image-2091 screenshot" title="Link Database" src="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_2-500x314.png" alt="" width="500" height="314" /></a></p>
<p>Once the database is linked get the connection string by using the &#8220;View conneciton strings&#8221; link on the site&#8217;s dashboard page:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_3.png"><img class="alignnone size-full wp-image-2111 screenshot" title="View Connection String" src="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_3.png" alt="" width="251" height="336" /></a></p>
<p>You will need the information from this connection string to logon to the database via phpMyAdmin. It will looks similar to this:</p>
<pre name="code" class="dos">
Database=some-db-name;Data Source=some-hostname;User Id=some-username;Password=some-password
</pre>
<h2>3. Download and configure phpMyAdmin</h2>
<p>Get the latest version of phpMyAdmin from the offical site. Extract it to some temporary location on your hard drive. Create a new file with name <strong>config.inc.php</strong> in the same directory where <strong>examples</strong>, <strong>js</strong>, <strong>libraries</strong>, <strong>setup</strong> and <strong>themes</strong> directories are. Paste the following into that file:</p>
<pre name="code" class="php">
&lt;?php
$cfg[&#039;blowfish_secret&#039;] = &#039;ba17c1ec07d65003&#039;;  // use here a value of your choice
$i = 0;
/* First server */
$i++;
/* Authentication type */
$cfg[&#039;Servers&#039;][$i][&#039;auth_type&#039;] = &#039;cookie&#039;;
/* Server parameters */
$cfg[&#039;Servers&#039;][$i][&#039;host&#039;] = &#039;some-hostname&#039;;  // Replace with value from connection string
$cfg[&#039;Servers&#039;][$i][&#039;connect_type&#039;] = &#039;tcp&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;compress&#039;] = false;
$cfg[&#039;Servers&#039;][$i][&#039;extension&#039;] = &#039;mysqli&#039;;
$cfg[&#039;Servers&#039;][$i][&#039;AllowNoPassword&#039;] = false;
?&gt;
</pre>
<h2>5. Upload phpMyAdmin files to Windows Azure</h2>
<p>Multiple upload methods are supported. I used FTP with FileZilla. FTP hostname and username can be obtained from the site&#8217;s dashboard page in management portal. Once you connected via FTP, upload all the files into the <strong>/site/wwwroot/</strong> directory.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_4.png"><img class="alignnone size-medium wp-image-2131 screenshot" title="FTP Upload" src="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_4-500x500.png" alt="" width="500" height="500" /></a></p>
<h2>6. Logon to MySql database</h2>
<p>Browse to the newly created site. You should see the phpMyAdmin logon page:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_5.png"><img class="alignnone size-medium wp-image-2141 screenshot" title="phpMyAdmin logon page" src="http://ruslany.net/wp-content/uploads/2012/12/phpMyAdmin_5-500x362.png" alt="" width="500" height="362" /></a></p>
<p>Use the User Id and Password from the connection string to logon.</p>
]]></content:encoded><description>In my previous post about the migration of a WordPress site to Windows Azure I mentioned that I used phpMyAdmin to import existing blog data into a MySql/ClearDb database in Windows Azure. phpMyAdmin is a web based tool for administering MySql databases. It can be used to create tables, edit the data in tables, export/import/backup data and [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2012/12/phpmyadmin-on-windows-azure-web-sites/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">9</slash:comments></item><item><title>RuslanY.net running on Windows Azure Web Sites</title><link>http://ruslany.net/2012/10/ruslany-net-running-on-windows-azure-web-sites/</link><category>PHP</category><category>URLRewrite</category><category>WAWS</category><category>WinCache</category><category>WordPress</category><category>Windows Azure</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Mon, 22 Oct 2012 08:30:36 PDT</pubDate><guid isPermaLink="false">http://ruslany.net/?p=1401</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>I have not been writing any blog posts for a while. That was because for the past two years I have been busy working in a team that develops the <a href="https://www.windowsazure.com/en-us/home/scenarios/web-sites/">Windows Azure Web Sites</a> &#8211; a scalable web hosting platform in Windows Azure.</p>
<p>Now that the Windows Azure Web Sites (WAWS) is publicly available I decided to try to move my site from private hosting  to Windows Azure. My site uses WordPress (with MySql database), PHP 5.3, WinCache object and user cache, URL rewriting and many WordPress plugins. With all these different technologies (many of which are not developed by Microsoft), I thought it would be a good test of how WAWS is capable of running web sites that use open source technologies. Plus I expect that my site will be more reliable and available, comparing to my previous private hosting.</p>
<p>I was pleasantly surprised that the migration from private hosting to WAWS hosting was relatively quick and simple. The site has been running successfully in a <a href="https://www.windowsazure.com/en-us/pricing/calculator/">Shared compute mode</a> for a while now and none of the site’s functionality has been lost or altered. In this post I’ll explain the steps I took to move my site to WAWS hosting. Hopefully it will be useful to those who are planning to migrate their WordPress based site to WAWS.<span id="more-1401"></span></p>
<h2>1. Signing up and creating an empty site</h2>
<p>The sign up process is straightforward and quick. If you have not signed up before then you can get a <a href="https://www.windowsazure.com/en-us/pricing/free-trial/">90-days free trial</a>, where you can try all the WAWS hosting options for free. Once you complete the sign up process you will end up at the Windows Azure Management Portal and start creating sites. In my case I started by creating an empty free web site <a href="http://ruslany.azurewebsites.net">http://ruslany.azurewebsites.net</a>. It takes only a few seconds to create a new site.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/10/CreateEmptySite.png"><img class="alignnone size-medium wp-image-1431 screenshot" title="CreateEmptySite" src="http://ruslany.net/wp-content/uploads/2012/10/CreateEmptySite-500x388.png" alt="" width="500" height="388" /></a></p>
<h2>2. Creating a MySql database</h2>
<p>WAWS works in partnership with <a href="https://www.cleardb.com/store/azure">ClearDb</a> to provide MySql databases. If you have a relatively small web application with light traffic then the free MySql database provided in Windows Azure should be enough for you. You can create the database by going to the Linked Resources page  and adding a new Linked Resource:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/10/CreateMySqlDB.png"><img class="alignnone size-medium wp-image-1471 screenshot" title="CreateMySqlDB" src="http://ruslany.net/wp-content/uploads/2012/10/CreateMySqlDB-500x388.png" alt="Create MySql DB" width="500" height="388" /></a></p>
<p>My site&#8217;s database was bigger than 20 Mb in size, so I had to purchase the <a href="https://www.cleardb.com/store/azure">Venus Service Plan</a> on the ClearDB site.</p>
<h2>3. Importing data to a MySql database</h2>
<p>WAWS provides a web management interface for SQL Azure databases. But not for MySql databases. That was not a problem however, because there is a well known web application for administering MySql – <a href="http://www.phpmyadmin.net/home_page/index.php">phpMyAdmin</a>. To import the content of my blog I created a new site under my subscription (10 free sites are allowed per subscription) and installed phpMyAdmin there. phpMyAdmin provides a simple way of importing MySql content into a database:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/10/ImportDb.png"><img class="alignnone size-medium wp-image-1491 screenshot" title="ImportDb" src="http://ruslany.net/wp-content/uploads/2012/10/ImportDb-500x266.png" alt="Import Db Data" width="500" height="266" /></a></p>
<p>Unfortunately, phpMyAdmin is not yet available in the Windows Azure Web Application Gallery, so I had to install it manually by following the <a href="http://www.phpmyadmin.net/documentation/#quick_install">quick install guide</a>.</p>
<p><strong>Important thing to note</strong> about importing data using phpMyAdmin. Import requires uploading a sql file to the server. If the sql file is big, you may run into the PHP limit for maximum allowed size of uploaded file. It is possible to increase the limit by following instructions at <a href="http://blogs.msdn.com/b/silverlining/archive/2012/07/10/configuring-php-in-windows-azure-websites-with-user-ini-files.aspx">Configuring PHP in Windows Azure Websites with .user.ini Files</a>.</p>
<h2>4. Point WordPress to new database</h2>
<p>Once database import is complete, it is necessary to reconfigure WordPress to use new database. The configuration is stored in <strong>wp-config.php</strong> file. Change the DB_NAME, DB_USER, DB_PASSWORD, DB_HOST variables to the values provided by ClearDB.</p>
<h2>5. Uploading the site content</h2>
<p>There are several ways to publish content in WAWS:</p>
<ol>
<li>FTP</li>
<li>WebDeploy</li>
<li>Git</li>
<li>TFS</li>
</ol>
<p>In order to simplify publishing, I recommend to set the publishing password to something you can remember. Otherwise you’ll have to use the randomly generated password that WAWS provided for your site.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/10/ResetPublishingPassword.png"><img class="alignnone size-full wp-image-1511 screenshot" title="ResetPublishingPassword" src="http://ruslany.net/wp-content/uploads/2012/10/ResetPublishingPassword.png" alt="Reset Publishing Password" width="251" height="233" /></a></p>
<p>FTP was good enough for my needs. The FTP host name and user name are available in the site dashboard page.</p>
<p>You can use any FTP client. <a href="http://filezilla-project.org/">Filezilla</a> works pretty well for uploading large content.</p>
<h2>5. Configuring custom domains</h2>
<p>After I uploaded content I just browsed to <a href="http://ruslany.azurewebsites.com/">http://ruslany.azurewebsites.com/</a> and the site was up and running. Obviously I did not want to use this domain for my site, so the next step was to associate <a href="http://ruslany.net/">http://ruslany.net/</a> with this site.</p>
<p>Free sites in WAWS are not allowed to have custom domains, so I had to upgrade my site to “Shared” compute mode.  Apart from custom domains support, there are other benefits of this mode: less restrictive usage quotas and no outgoing bandwidth limit.</p>
<p>Configuring custom domain is a straightforward process described in <a href="https://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns-web-site/">Windows Azure documentation</a>. It is a good idea to associate both A record and the WWW CName with a site. In my case for example both <a href="http://ruslany.net">http://ruslany.net</a> and <a href="http://www.ruslany.net/">http://www.ruslany.net/</a> are associated with the site:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2012/10/CustomDomains.png"><img class="alignnone size-medium wp-image-1521 screenshot" title="CustomDomains" src="http://ruslany.net/wp-content/uploads/2012/10/CustomDomains-467x500.png" alt="Custom Domains" width="467" height="500" /></a></p>
<h2>Conclusion</h2>
<p>There are a couple of minor limitations that still need to be fixed in WAWS:</p>
<ul>
<li>An old version of Wincache extension is used which causes <a href="http://ruslany.net/2011/04/wincache-and-wordpress-plugin-upgrade-problem/">failures when upgrading plugins</a>.</li>
<li>It would be nice to have phpMyAdmin available in the Web Application Gallery.</li>
</ul>
<p>Other than that I am pretty happy with how my site is running in Windows Azure Web Sites so far. WAWS is capable and flexible enough to support all the custom configuration settings that my site uses.</p>
<ul>
<li>Wincache object and user caches work well. They reduce load on the MySql database and make the response time faster.</li>
<li>URL rewriting is fully supported, so my site is still optimized for search engines and has pretty permalinks.</li>
<li>All the plugins work without problems.</li>
</ul>
<p>As I find out more tips and tricks about hosting web sites in Windows Azure Web Sites I will write about them in this blog.</p>
]]></content:encoded><description>I have not been writing any blog posts for a while. That was because for the past two years I have been busy working in a team that develops the Windows Azure Web Sites &amp;#8211; a scalable web hosting platform in Windows Azure. Now that the Windows Azure Web Sites (WAWS) is publicly available I [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2012/10/ruslany-net-running-on-windows-azure-web-sites/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">6</slash:comments></item><item><title>Command line tools for managing PHP in IIS</title><link>http://ruslany.net/2011/06/command-line-tools-for-managing-php-in-iis/</link><category>PHP</category><category>PHP Manager</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Tue, 28 Jun 2011 10:30:46 PDT</pubDate><guid isPermaLink="false">http://ruslany.net/?p=1096</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>The latest release of <a href="http://phpmanager.codeplex.com/releases/">PHP Manager 1.2 for IIS </a>now includes Windows PowerShell commands that can be used to install, configure and manage PHP on IIS 7 from command line. In addition those commands can be used to automate the configuration and management tasks.</p>
<p>Here are examples of what can be done with PHP Manager command line tools:<span id="more-1096"></span></p>
<ul>
<li>Register a new PHP version:</li>
</ul>
<pre name="code" class="dos">
PS C:\Users\Administrator&gt;New-PHPVersion -ScriptProcessor &quot;C:\PHP\536\php-cgi.exe&quot;
</pre>
<ul>
<li>Get information about current PHP configuration:</li>
</ul>
<pre name="code" class="dos">
PS C:\Users\Administrator&gt; Get-PHPConfiguration

HandlerName              : php-5.3.6
Version                  : 5.3.6
ScriptProcessor          : C:\php\536\php-cgi.exe
HandlerType              : Local
ErrorLog                 : C:\Windows\Temp\php-5.3.6_errors.log
PHPIniFilePath           : C:\php\536\php.ini
InstalledExtensionsCount : 35
EnabledExtensionsCount   : 9
</pre>
<ul>
<li>Change PHP version for a particular web site or a folder:</li>
</ul>
<pre name="code" class="dos">
PS C:\Users\Administrator&gt; Set-PHPVersion -HandlerName php-5.3.6 -SiteName &quot;Default Web Site&quot;
PS C:\Users\Administrator&gt; Get-PHPVersion -SiteName &quot;Default Web Site&quot;

HandlerName      Version      ScriptProcessor             Active
------------     -------      ---------------             ------
php-5.3.6        5.3.6        C:\php\536\php-cgi.exe      True
php-5.2.17       5.2.17       C:\php\5217\php-cgi.exe     False
</pre>
<ul>
<li>Change PHP settings:</li>
</ul>
<pre name="code" class="dos">
PS C:\Users\Administrator&gt; Set-PHPSetting -Name display_errors -Value On
PS C:\Users\Administrator&gt; Get-PHPSetting -Name *error*

Name                         Value                               Section
----                         -----                               -------
error_reporting              E_ALL                               PHP
display_errors               On                                  PHP
display_startup_errors       Off                                 PHP
log_errors                   On                                  PHP
log_errors_max_len           1024                                PHP
ignore_repeated_errors       Off                                 PHP
track_errors                 Off                                 PHP
html_errors                  Off                                 PHP
mssql.min_error_severity     10                                  MSSQL
error_log                    C:\Windows\temp\php53_errors.log    WebPIChanges
</pre>
<ul>
<li>Enable PHP extensions:</li>
</ul>
<pre name="code" class="dos">


PS C:\Users\Administrator&gt; Get-PHPExtension -Name *pdo*sql* | Set-PHPExtension -Status enabled
PS C:\Users\Administrator&gt; Get-PHPExtension -Name *pdo*sql*

Name                                 Status
----                                 ------
php_pdo_mysql.dll                    Enabled
php_pdo_sqlite.dll                   Enabled
php_pdo_sqlsrv.dll                   Enabled
php_pdo_pgsql.dll                    Enabled


</pre>
<p>Note that the example above demonstrates that it is possible to pipe several commands together. In this particular example the commands are used to enable all PHP extensions that contain &#8220;pdo&#8221; and &#8220;sql&#8221; in their names.</p>
<ul>
<li>Get detailed help for commands and their usage examples:</li>
</ul>
<pre name="code" class="dos">


PS C:\Users\Administrator&gt; get-help Get-PHPExtension

NAME
Get-PHPExtension

SYNOPSIS
Gets the list of PHP extensions available in the currently active PHP version.

SYNTAX
Get-PHPExtension [[-Name] &lt;String&gt;] [[-Status] &lt;PHPExtensionStatus&gt;]
[-SiteName &lt;String&gt;] [-VirtualPath &lt;String&gt;] [&lt;CommonParameters&gt;]

DESCRIPTION
The Get-PHPExtension cmdlet outputs the list of all PHP extensions available
in the currently active PHP version. The list can be filtered by extension
name and by the status (enabled or disabled).

RELATED LINKS
Set-PHPExtension

REMARKS
To see the examples, type: &quot;get-help Get-PHPExtension -examples&quot;.
For more information, type: &quot;get-help Get-PHPExtension -detailed&quot;.
For technical information, type: &quot;get-help Get-PHPExtension -full&quot;.


</pre>
<p>Also, refer to the <a href="http://phpmanager.codeplex.com/wikipage?title=Managing%20PHP%20installations%20with%20PHP%20Manager%20command%20line">PHP Manager Documentation </a>to get more information and usage examples.</p>
<p>Other improvements in the v1.2 include French translation (thanks to Emmanuel Boersma and Sylvain Lecerf) and several bug fixes.</p>
<p>Use <a href="http://www.microsoft.com/web/downloads/default.aspx">Web Platform Installer</a> to get the latest release of PHP Manager for IIS.</p>
<p><a href="http://www.microsoft.com/web/gallery/install.aspx?appid=PHPManager"><img class="alignnone size-full wp-image-329 screenshot" title="Install PHP Manager 1.1 for IIS 7" src="http://ruslany.net/wp-content/uploads/2009/04/wpibadgesilver1.png" alt="" width="176" height="51" /></a></p>
]]></content:encoded><description>The latest release of PHP Manager 1.2 for IIS now includes Windows PowerShell commands that can be used to install, configure and manage PHP on IIS 7 from command line. In addition those commands can be used to automate the configuration and management tasks. Here are examples of what can be done with PHP Manager [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2011/06/command-line-tools-for-managing-php-in-iis/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">0</slash:comments></item><item><title>Using Piwik Real Time Web Analytics on IIS</title><link>http://ruslany.net/2011/05/using-piwik-real-time-web-analytics-on-iis/</link><category>Other</category><category>Piwik</category><category>Web Analytics</category><category>WebPI</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Mon, 16 May 2011 09:45:15 PDT</pubDate><guid isPermaLink="false">http://ruslany.net/?p=1060</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>A month ago I have stopped using Google Analytics for my site and instead gave a try to <a href="http://piwik.org/">Piwik</a> – an open source, PHP/MySQL based real time web analytics application. Since then it has been working well for my site and overall to me it looks like a better alternative to Google Analytics.</p>
<p>Here are the things that I like:<span id="more-1060"></span></p>
<ul>
<li><strong>Real Time Visitor Log</strong> – this is a very cool feature as it shows in real time who is on your site, where they came from and what they do:<br />
<a href="http://ruslany.net/wp-content/uploads/2011/05/piwik1.png"><img class="alignnone size-medium wp-image-1061 screenshot" title="Piwik Real Time Visitors Report" src="http://ruslany.net/wp-content/uploads/2011/05/piwik1-500x217.png" alt="" width="500" height="217" /></a></li>
<li><strong>Hourly Visits Chart</strong> – shows number of visits throughout the day<br />
<a href="http://ruslany.net/wp-content/uploads/2011/05/piwik2.png"><img class="alignnone size-full wp-image-1062 screenshot" title="Piwik hourly visits chart" src="http://ruslany.net/wp-content/uploads/2011/05/piwik2.png" alt="" width="368" height="335" /></a></li>
<li><strong>Real-Time-ness in general</strong> – all the reports, such as keywords, referring sites and search engines, visitors, etc are available for today, as opposed to previous day in Google Analytics. This allows to immediately react to any problems that may occur on the site throughout the day.</li>
<li><strong>Ability to opt-out</strong> – any visitor can opt out from being recorded for web analytics purposes. For example I have opted out myself so that my own visits to my site do not skew the statistics.</li>
</ul>
<p>Piwik is available in the <a href="http://www.microsoft.com/web/gallery/piwik.aspx">Web Application Gallery</a> and there are several ways you can try it out:</p>
<ul>
<li>Use <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web Platform Installer</a> to setup Piwik on your IIS server;</li>
<li>Use <a href="http://www.microsoft.com/web/webmatrix/">Microsoft WebMatrix</a> to setup Piwik on a development machine, try it out and then deploy on a hosting server;</li>
<li>And finally use one of the <strong>free</strong> cloud hosting preview offers listed here <a title="http://www.iis.net/previewoffers" href="http://www.iis.net/previewoffers">http://www.iis.net/previewoffers</a>.</li>
</ul>
<p>The setup experience for Piwik on any of those hosting preview servers is very simple. Once you register your account, create a MySQL database that will be used by Piwik:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/05/piwik6.png"><img class="alignnone size-medium wp-image-1063 screenshot" title="Create new MySQL database" src="http://ruslany.net/wp-content/uploads/2011/05/piwik6-500x373.png" alt="" width="500" height="373" /></a></p>
<p>Make sure to take note of the database server name that hosts your newly created database – you will need to enter it later during Piwik installation procedure.</p>
<p>After that go to the Gallery tab, use the search box to find Piwik and then follow the simple installation steps.</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/05/piwik5.png"><img class="alignnone size-medium wp-image-1072 screenshot" title="piwik5" src="http://ruslany.net/wp-content/uploads/2011/05/piwik5-500x357.png" alt="" width="500" height="357" /></a></p>
<p>On the database setup page enter the database connectivity settings that you’ve obtained when you created a new MySQL database:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/05/piwik7.png"><img class="alignnone size-medium wp-image-1064 screenshot" title="Specify database connectivity" src="http://ruslany.net/wp-content/uploads/2011/05/piwik7-500x390.png" alt="" width="500" height="390" /></a></p>
<p>Specify the site you want to track:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/05/piwik8.png"><img class="alignnone size-medium wp-image-1065 screenshot" title="piwik8" src="http://ruslany.net/wp-content/uploads/2011/05/piwik8-500x333.png" alt="" width="500" height="333" /></a></p>
<p>and then copy the provided JavaScript code and add it to your site’s pages. That completes the installation procedure and now you should be able to see the Piwik dashboard:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/05/piwik9.png"><img class="alignnone size-medium wp-image-1066 screenshot" title="Piwik Dashboard" src="http://ruslany.net/wp-content/uploads/2011/05/piwik9-500x375.png" alt="" width="500" height="375" /></a></p>
]]></content:encoded><description>A month ago I have stopped using Google Analytics for my site and instead gave a try to Piwik – an open source, PHP/MySQL based real time web analytics application. Since then it has been working well for my site and overall to me it looks like a better alternative to Google Analytics. Here are [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2011/05/using-piwik-real-time-web-analytics-on-iis/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">2</slash:comments></item><item><title>WinCache Object Cache plugin for WordPress</title><link>http://ruslany.net/2011/05/wincache-object-cache-plugin-for-wordpress/</link><category>WinCache</category><category>WordPress</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Sun, 08 May 2011 23:55:35 PDT</pubDate><guid isPermaLink="false">http://ruslany.net/?p=1046</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>The <a href="http://wordpress.org/extend/plugins/wincache-object-cache-backend/">WinCache Object Cache plugin</a> provides a persistent memory-based backend for the WordPress object cache. An object cache is a place for WordPress and WordPress extensions to store the results of complex operations. On subsequent loads, this data can be fetched from the cache, which will be must faster than dynamically generating it on every page load.</p>
<p>The WinCache Object Cache for WordPress is available at the following location:</p>
<p><a title="http://wordpress.org/extend/plugins/wincache-object-cache-backend/" href="http://wordpress.org/extend/plugins/wincache-object-cache-backend/">http://wordpress.org/extend/plugins/wincache-object-cache-backend/</a></p>
<p><strong>Note</strong>: if you use the old version that you have downloaded from blog post about how to <a href="http://ruslany.net/2010/03/make-wordpress-faster-on-iis-with-wincache-1-1/">Make WordPress faster on IIS with WinCache 1.1</a>, then it is highly recommended to upgrade to the version from wordpress.org.</p>
<p>The plugin is based on the code written by <a href="http://markjaquith.wordpress.com/">Mark Jaquith</a> for his <a href="http://wordpress.org/extend/plugins/apc/">APC Object Cache</a> WordPress plugin. Thanks to <a href="http://andrewnacin.com/">Andrew Nacin</a> for pointing me to that plugin and suggesting to publish similar one for WinCache.</p>
]]></content:encoded><description>The WinCache Object Cache plugin provides a persistent memory-based backend for the WordPress object cache. An object cache is a place for WordPress and WordPress extensions to store the results of complex operations. On subsequent loads, this data can be fetched from the cache, which will be must faster than dynamically generating it on every [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2011/05/wincache-object-cache-plugin-for-wordpress/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">7</slash:comments></item><item><title>WinCache and WordPress plugin upgrade problem</title><link>http://ruslany.net/2011/04/wincache-and-wordpress-plugin-upgrade-problem/</link><category>PHP</category><category>WinCache</category><category>WordPress</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Thu, 14 Apr 2011 11:47:43 PDT</pubDate><guid isPermaLink="false">http://ruslany.net/?p=1009</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>The WinCache extension 1.1 for PHP has been released last year. Since then several customers reported <a href="http://pecl.php.net/bugs/bug.php?id=18010">a bug</a> in the extension that prevents WordPress and other PHP applications from performing automatic upgrades of their plugins. This was reported on <a href="http://wordpress.org/support/topic/wordpress-on-iis-7-plugin-update-problem?replies=33">WordPress forum</a> as well as on <a href="http://forums.iis.net/t/1169832.aspx">WinCache forum</a>.</p>
<p>The new build of WinCache with the fix for this problem is available now at the following location:</p>
<p><a title="https://sourceforge.net/projects/wincache/files/development/" href="https://sourceforge.net/projects/wincache/files/development/">https://sourceforge.net/projects/wincache/files/development/</a></p>
<p>The latest dev build at that location is a release candidate build. Several customers have already verified that this build fixes the problem and is running stable in their environments. Please try it out and let me know if it works or does not work for you. The things to try and to look for are:</p>
<ol>
<li>Try to auto-upgrade any of the WordPress plugins;</li>
<li>After installing this build check the Windows Application event log from time to time looking for errors caused by module “php_wincache.dll”.</li>
</ol>
<p>If you see any errors while using this build please let me know by leaving a comment here or in <a href="http://forums.iis.net/1164.aspx">WinCache forum</a> or by opening a bug in <a href="http://pecl.php.net/bugs/search.php?cmd=display&amp;status=Open&amp;package_name[]=WinCache">PECL bug database</a>.</p>
]]></content:encoded><description>The WinCache extension 1.1 for PHP has been released last year. Since then several customers reported a bug in the extension that prevents WordPress and other PHP applications from performing automatic upgrades of their plugins. This was reported on WordPress forum as well as on WinCache forum. The new build of WinCache with the fix [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2011/04/wincache-and-wordpress-plugin-upgrade-problem/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">40</slash:comments></item><item><title>PHP Manager for IIS is available in 5 languages</title><link>http://ruslany.net/2011/03/php-manager-for-iis-is-available-in-5-languages/</link><category>PHP</category><category>PHP Manager</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Thu, 10 Mar 2011 13:00:18 PST</pubDate><guid isPermaLink="false">http://ruslany.net/?p=990</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p>A new release of <a href="http://phpmanager.codeplex.com/releases/">PHP Manager for IIS (version 1.1.2)</a> is available for download. This release includes translations into 5 languages:</p>
<ul>
<li><strong>German</strong> &#8211; the translation is provided by <a href="http://www.codeplex.com/site/users/view/Volleyknaller">Christian Graefe</a></li>
<li><strong>Dutch</strong> &#8211; the translation is provided by <a href="http://www.harrieverveer.com/">Harrie Verveer</a></li>
<li><strong>Turkish</strong> &#8211; the translation is provided by <a href="http://www.yusufozturk.info/">Yusuf Oztürk</a></li>
<li><strong>Japanese</strong> &#8211; the translation is provided by <a href="http://www.codeplex.com/site/users/view/z3zenzai">Kenichi Wakasa</a></li>
<li><strong>Russian</strong> &#8211; the translation is provided by <a href="http://ruslany.net/">Ruslan Yakushev</a></li>
</ul>
<p>Thanks to above mentioned people for providing these high quality translations! The <a href="http://phpmanager.codeplex.com/team/view">PHP Manager Project</a> is still looking for volunteers who can help with Spanish, French and Chinese translations.</p>
<p>Note that this release still includes English and it is recommended to upgrade even if you do not need these translations.</p>
<p>Use <a href="http://www.microsoft.com/web/downloads/default.aspx">Web Platform Installer</a> to get the latest release of PHP Manager for IIS (make sure to upgrade to the latest build of Web Platform Installer to get this release of PHP Manager).</p>
<p><a href="http://www.microsoft.com/web/gallery/install.aspx?appid=PHPManager"><img title="Install PHP Manager 1.1 for IIS 7" class="alignnone size-full wp-image-329 screenshot" src="http://ruslany.net/wp-content/uploads/2009/04/wpibadgesilver1.png" alt="" width="176" height="51" /></a></p>
]]></content:encoded><description>A new release of PHP Manager for IIS (version 1.1.2) is available for download. This release includes translations into 5 languages: German &amp;#8211; the translation is provided by Christian Graefe Dutch &amp;#8211; the translation is provided by Harrie Verveer Turkish &amp;#8211; the translation is provided by Yusuf Oztürk Japanese &amp;#8211; the translation is provided by [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2011/03/php-manager-for-iis-is-available-in-5-languages/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">10</slash:comments></item><item><title>How to enable Xdebug in WebMatrix</title><link>http://ruslany.net/2011/02/how-to-enable-xdebug-in-webmatrix/</link><category>PHP</category><category>WebMatrix</category><category>Xdebug</category><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ruslany</dc:creator><pubDate>Fri, 18 Feb 2011 11:07:58 PST</pubDate><guid isPermaLink="false">http://ruslany.net/?p=977</guid><content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<p><a href="http://xdebug.org/">Xdebug</a> is a very popular PHP extension that helps with debugging and profiling of PHP scripts by providing a lot of valuable debug information. <a href="http://www.microsoft.com/web/webmatrix/">Microsoft WebMatrix </a>is a development tool for building web applications. When WebMatrix is used to build or modify a PHP-based web application the debugging tasks can be greatly simplified if Xdebug extension is used. This post explains how to install and use Xdebug extension with WebMatrix.<span id="more-977"></span></p>
<p><strong>Step 1</strong>: Enable PHP in WebMatrix from the site “Settings” page:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/02/EnablePHP.png"><img class="alignnone size-medium wp-image-978 screenshot" title="Enable PHP in WebMatrix" src="http://ruslany.net/wp-content/uploads/2011/02/EnablePHP-500x326.png" alt="" width="500" height="326" /></a></p>
<p>Note that if you installed any of the PHP applications from the Application Gallery then PHP will be automatically enabled.</p>
<p><strong>Step 2</strong>: Download the appropriate build of Xdebug extension from <a href="http://xdebug.org/download.php">downloads page</a>. If your site uses PHP 5.2 then download “<em>5.2 VC6 Non-thread safe (32 bit)</em>”. If your site uses PHP 5.3 then download “<em>5.3 VC9 Non-thread safe (32 bit)</em>”. <strong>Use 32 bit build even if your Windows OS is 64 bit</strong>.</p>
<p><strong>Step 3</strong>: Install the extension by copying the downloaded file to the following locations:</p>
<ul>
<li>For PHP 5.2 on Windows 64 bit:<br />
C:\Program Files (x86)\IIS Express\PHP\v5.2\ext\</li>
<li>For PHP 5.2 on Windows 32 bit:<br />
C:\Program Files\IIS Express\PHP\v5.2\ext\</li>
<li>For PHP 5.3 on Windows 64 bit:<br />
C:\Program Files (x86)\IIS Express\PHP\v5.3\ext\</li>
<li>For PHP 5.3 on Windows 32 bit:<br />
C:\Program Files\IIS Express\PHP\v5.3\ext\</li>
</ul>
<p><strong>Step 4</strong>: Open the php.ini file located in the PHP installation folder, e.g.<br />
C:\Program Files\IIS Express\PHP\v5.2\php.ini and append the following at the end (make sure that the absolute path is correct for your version of PHP and Windows.):</p>
<pre name="code" class="dos">
[xdebug]
zend_extension = C:\Program Files\iis express\PHP\v5.2\ext\php_xdebug-2.1.0-5.2-vc6-nts.dll
</pre>
<p><strong>Step 5</strong>: Configure PHP to display errors by changing these PHP settings in php.ini file:</p>
<pre name="code" class="dos">
display_errors = On
error_reporting = E_ALL &amp; ~E_NOTICE
</pre>
<p><strong>Step 6</strong>: Test that extension is enabled and works by either calling a phpinfo() function from a script or by running a buggy script:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/02/DivideByZero.png"><img class="alignnone size-medium wp-image-981 screenshot" title="Xdebug output" src="http://ruslany.net/wp-content/uploads/2011/02/DivideByZero-500x246.png" alt="" width="500" height="246" /></a></p>
<p>The Xdebug extension provides a lot of useful features that help with debugging of PHP applications. You can learn more about them from the <a href="http://xdebug.org/docs/">Xdebug documentation</a>. For example you can use it to profile a PHP application. Just change the php.ini file as shown below and then make a request to a PHP script:</p>
<pre name="code" class="dos">
[xdebug]
zend_extension = C:\Program Files\iis express\PHP\v5.2\ext\php_xdebug-2.1.0-5.2-vc6-nts.dll
xdebug.profiler_enable = On
xdebug.profiler_output_dir = C:\Windows\temp
</pre>
<p>The profile log will be saved into the specified directory and will have a name cachegrind.out.* Use <a href="http://sourceforge.net/projects/wincachegrind/">WinCacheGrind</a> to open and analyze it:</p>
<p><a href="http://ruslany.net/wp-content/uploads/2011/02/Wincachegrind.png"><img class="alignnone size-medium wp-image-982 screenshot" title="WinCacheGrind output" src="http://ruslany.net/wp-content/uploads/2011/02/Wincachegrind-500x355.png" alt="" width="500" height="355" /></a></p>
]]></content:encoded><description>Xdebug is a very popular PHP extension that helps with debugging and profiling of PHP scripts by providing a lot of valuable debug information. Microsoft WebMatrix is a development tool for building web applications. When WebMatrix is used to build or modify a PHP-based web application the debugging tasks can be greatly simplified if Xdebug [...]</description><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://ruslany.net/2011/02/how-to-enable-xdebug-in-webmatrix/feed/</wfw:commentRss><slash:comments xmlns:slash="http://purl.org/rss/1.0/modules/slash/">5</slash:comments></item></channel></rss>
