<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sides of march &#187; PHP</title>
	<atom:link href="http://www.sidesofmarch.com/index.php/archive/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sidesofmarch.com</link>
	<description>Thoughts on life, liberty, and information technology</description>
	<lastBuildDate>Mon, 16 Jan 2012 02:43:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing and configuring memcached and PHP on Windows</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2010/09/02/installing-and-configuring-memcached-and-php-on-windows/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2010/09/02/installing-and-configuring-memcached-and-php-on-windows/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 12:14:21 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[vBulletin]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/?p=436</guid>
		<description><![CDATA[<p>After upgrading the <a href="http://forums.csfbl.com">CSFBL forums</a> to <a href="http://www.vbulletin.com">vBulletin 4.0</a>, I noticed that performance was slightly worse than in the previous version. A little searching revealed that <a href="http://www.vbulletin.com/forum/entry.php?2391-Supercharge-your-vBulletin-Forum-with-Memcached">vBulletin supports memcached</a> (an <a href="http://memcached.org/">in-memory distributed caching system</a>). Since I&#8217;ve got RAM to spare, I figured this is worth a shot.</p>
<p>Unfortunately, getting memcached running on the server (Windows Server 2008 R2 64-bit) took a few tricks, and getting memached running through IIS/PHP was another. To help other people through the same process (and to remind myself in the future), I&#8217;ll share the installation and configuration steps that worked for me below.</p>
Downloading and configuring memcached
<p>The official distributions of memcached are written for Linux systems, so the first task is finding Windows binaries. The <a href="http://code.google.com/p/memcached/wiki/NewStart?tm=6">memcached project site</a>, fortunately, has links to <a title="Windows Platform - memcached" href="http://code.google.com/p/memcached/wiki/PlatformWindows">Windows binaries</a>, which are <a title="memcached binary downloads - NorthScale Labs" href="http://labs.northscale.com/memcached-packages/">hosted by NorthScale</a>. Both 32-bit and 64-bit versions are available.</p>
<p>(Note that NorthScale also offers their own <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2010/09/02/installing-and-configuring-memcached-and-php-on-windows/">Installing and configuring memcached and PHP on Windows</a></span>]]></description>
			<content:encoded><![CDATA[<p>After upgrading the <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fforums.csfbl.com&sref=rss">CSFBL forums</a> to <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.vbulletin.com&sref=rss">vBulletin 4.0</a>, I noticed that performance was slightly worse than in the previous version. A little searching revealed that <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.vbulletin.com%2Fforum%2Fentry.php%3F2391-Supercharge-your-vBulletin-Forum-with-Memcached&sref=rss">vBulletin supports memcached</a> (an <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fmemcached.org%2F&sref=rss">in-memory distributed caching system</a>). Since I&#8217;ve got RAM to spare, I figured this is worth a shot.</p>
<p>Unfortunately, getting memcached running on the server (Windows Server 2008 R2 64-bit) took a few tricks, and getting memached running through IIS/PHP was another. To help other people through the same process (and to remind myself in the future), I&#8217;ll share the installation and configuration steps that worked for me below.</p>
<h4>Downloading and configuring memcached</h4>
<p>The official distributions of memcached are written for Linux systems, so the first task is finding Windows binaries. The <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fcode.google.com%2Fp%2Fmemcached%2Fwiki%2FNewStart%3Ftm%3D6&sref=rss">memcached project site</a>, fortunately, has links to <a title="Windows Platform - memcached" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fcode.google.com%2Fp%2Fmemcached%2Fwiki%2FPlatformWindows&sref=rss">Windows binaries</a>, which are <a title="memcached binary downloads - NorthScale Labs" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Flabs.northscale.com%2Fmemcached-packages%2F&sref=rss">hosted by NorthScale</a>. Both 32-bit and 64-bit versions are available.</p>
<p>(Note that NorthScale also offers their own <a title="NorthScale Memcached Server" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Finfo.northscale.com%2FMemcached.html&sref=rss">free distribution of memcached</a>, but I was unable to get this to run on my system.)</p>
<p>Versions of memcached prior to 1.4.5 supported a command-line option that would register memcached as a Windows service (as in <code>memcached -d install</code>), but this option was <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fcode.google.com%2Fp%2Fmemcached%2Fissues%2Fdetail%3Fid%3D149&sref=rss">removed in version 1.4.5</a>. The simple alternative is to schedule memcached.exe to run using the <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FTask_Scheduler%23Task_Scheduler_2.0&sref=rss">Task Scheduler service (Windows 2008/Vista/7)</a>.</p>
<p>You can create a task to run memcached on system startup using the following command line:</p>
<p style="padding-left: 30px;"><code>schtasks /create /sc onstart /tn memcached /tr "'c:\dev\utils\memcached-amd64\memcached.exe' -m 128"</code></p>
<p>Note the <code>-m 128</code> argument; this tells memcached to use up to 128MB of RAM. There are other <a title="Memcached command line arguments" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fcode.google.com%2Fp%2Fmemcached%2Fwiki%2FNewConfiguringServer%23Commandline_Arguments&sref=rss">command line arguments </a>available; most useful aside from <code>-m</code> are <code>-l</code> (to specify what IP addresses to bind to) and <code>-vv</code> (to add verbose logging to the console, useful for testing).</p>
<h4>Integrating memcached with PHP</h4>
<p>In order for PHP to use memcached, you must download the PHP memcached library and add it as an extension to PHP.</p>
<p>PHP extensions can be downloaded from <a title="PHP extension library downloads" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fdownloads.php.net%2Fpierre%2F&sref=rss">http://downloads.php.net/pierre</a>. Many different extensions are in here; the one I used was <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fdownloads.php.net%2Fpierre%2Fphp_memcache-5.2-nts-Win32-vc6-x86-20090408.zip&sref=rss">php_memcache-5.2-nts-Win32-vc6-x86-20090408.zip</a>. This extension matches two key requirements:</p>
<ul>
<li>PHP version 5.2 (the version installed using the <a title="Microsoft Web Platform Installer download" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.microsoft.com%2Fweb%2Fdownloads%2Fplatform.aspx&sref=rss">Web Platform Installer</a>)</li>
<li>A non-thread-safe version of the extension (the version of PHP installed is not thread safe, which provides <a title="FastCGI, PHP, and IIS7" href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Flearn.iis.net%2Fpage.aspx%2F246%2Fusing-fastcgi-to-host-php-applications-on-iis-7%2F&sref=rss">performance improvements using FastCGI</a>)</li>
</ul>
<p>Getting the right version of the extension is important; download the thread-safe version, or the PHP 5.3 version, and it simply won&#8217;t work.</p>
<p>Once downloaded, take the <code>php_memcache.dll</code> and put it in the <code>ext</code> folder in your PHP directory (for me, <code>c:\Program Files (x86)\PHP\ext</code>). Then, open the <code>php.ini</code> file (in your PHP directory) and add the following line to the end:</p>
<p style="padding-left: 30px;"><code>extension=php_memcache.dll</code></p>
<p>Restart IIS (from the command line, type <code>iisreset</code>), and if you did everything right, memcached should now be available to PHP. If you want to check, you can <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fphp.net%2Fmanual%2Fen%2Ffunction.phpinfo.php&sref=rss">create a phpinfo page</a>; if php_memcache is listed in the output, the extension is registered correctly.</p>
<h4>Other links</h4>
<p>To find out more about PHP, memcached, and Windows, check out the following links.</p>
<ul>
<li><a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fwww.NorthScale.com%2FMemcached&sref=rss">NorthScale Memcached</a> &#8211; a free, commercial memcached distribution that I couldn&#8217;t get to work in my environment</li>
<li><a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fpureform.wordpress.com%2F2008%2F01%2F10%2Finstalling-memcache-on-windows-for-php%2F&sref=rss">Installing memcache on Windows for PHP</a> &#8211; a blog post explaining something similar to what I just did</li>
<li><a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fcode.jellycan.com%2Fmemcached%2F&sref=rss">memcached from Jellycan Code</a> &#8211; an alternate memcached build for Windows that runs as a service</li>
<li><a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Flongvnit.com%2Fblog%2F%3Fp%3D1155&sref=rss">Installing memcached on Windows</a> &#8211; instructions for installing the Jellycan Code version of memcached</li>
</ul>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=436&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2010/09/02/installing-and-configuring-memcached-and-php-on-windows/' addthis:title='Installing and configuring memcached and PHP on Windows ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2010/09/02/installing-and-configuring-memcached-and-php-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting to MSSQL with Apache and PHP on Windows</title>
		<link>http://www.sidesofmarch.com/index.php/archive/2008/05/15/connecting-to-mssql-with-apache-and-php-on-windows/</link>
		<comments>http://www.sidesofmarch.com/index.php/archive/2008/05/15/connecting-to-mssql-with-apache-and-php-on-windows/#comments</comments>
		<pubDate>Thu, 15 May 2008 14:18:04 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sidesofmarch.com/index.php/archive/2008/05/15/connecting-to-mssql-with-apache-and-php-on-windows/</guid>
		<description><![CDATA[<p>I set up a Windows server as a <a href="http://en.wikipedia.org/wiki/WAMP">WAMP</a> server (Windows, Apache, MySQL, and PHP) to run vBulletin. Everything worked fine, and the learning curve was pretty short.</p>
<p>Then I tried getting PHP to connect to a remote Microsoft SQL server. Sorry, no luck!</p>
<p>The apparent fix required an updated <strong>ntwdblib.dll</strong>. The one that came with the latest PHP5 bits (5.2.6) was apparently out of date (version 2000.2.8.0). A newer one, which I founded linked to from <a href="http://userscape.com/helpdesk/index.php?pg=kb.page&#38;id=13">a UserScape support page</a>, is version 2000.80.194.0. Shut down Apache, <a href="http://userscape.com/ntwdblib.dll">download the newer DLL</a> (replacing the old DLL), and restart Apache. Viola! Hello, MSSQL server.</p>
<a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a <span style="color:#777"> . . .<br /><br />&#8594; Read More: <a href="http://www.sidesofmarch.com/index.php/archive/2008/05/15/connecting-to-mssql-with-apache-and-php-on-windows/">Connecting to MSSQL with Apache and PHP on Windows</a></span>]]></description>
			<content:encoded><![CDATA[<p>I set up a Windows server as a <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FWAMP&sref=rss">WAMP</a> server (Windows, Apache, MySQL, and PHP) to run vBulletin. Everything worked fine, and the learning curve was pretty short.</p>
<p>Then I tried getting PHP to connect to a remote Microsoft SQL server. Sorry, no luck!</p>
<p>The apparent fix required an updated <strong>ntwdblib.dll</strong>. The one that came with the latest PHP5 bits (5.2.6) was apparently out of date (version 2000.2.8.0). A newer one, which I founded linked to from <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fuserscape.com%2Fhelpdesk%2Findex.php%3Fpg%3Dkb.page%26amp%3Bid%3D13&sref=rss">a UserScape support page</a>, is version 2000.80.194.0. Shut down Apache, <a href="http://redirectingat.com?id=17923X751173&xs=1&url=http%3A%2F%2Fuserscape.com%2Fntwdblib.dll&sref=rss">download the newer DLL</a> (replacing the old DLL), and restart Apache. Viola! Hello, MSSQL server.</p>
<img src="http://www.sidesofmarch.com/?ak_action=api_record_view&id=243&type=feed" alt="" /><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://www.sidesofmarch.com/index.php/archive/2008/05/15/connecting-to-mssql-with-apache-and-php-on-windows/' addthis:title='Connecting to MSSQL with Apache and PHP on Windows ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.sidesofmarch.com/index.php/archive/2008/05/15/connecting-to-mssql-with-apache-and-php-on-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

