<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>php on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/php/</link>
    <description>Recent content in php on S Anand</description>
    <generator>Hugo -- 0.156.0</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 08 Dec 2021 18:47:24 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/php/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Protect static files on Apache with OpenID</title>
      <link>https://www.s-anand.net/blog/protect-static-files-on-apache-with-openid/</link>
      <pubDate>Fri, 18 Nov 2011 23:11:50 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/protect-static-files-on-apache-with-openid/</guid>
      <description>&lt;p&gt;I moved from static HTML pages to web applications and back to static HTML files. There’s a lot to be said for the simplicity and portability of a bunch of files. Static site generators like &lt;a href=&#34;https://github.com/mojombo/jekyll&#34;&gt;Jekyll&lt;/a&gt; are increasingly popular; I’ve built a simple &lt;a href=&#34;https://bitbucket.org/sanand0/utils/src/tip/publish.make&#34;&gt;publisher&lt;/a&gt; that I use extensively.&lt;/p&gt;
&lt;p&gt;Web apps give you something else, though, that are still useful on a static site. Access control. I’ve been resorting to &lt;a href=&#34;http://httpd.apache.org/docs/2.2/programs/htpasswd.html&#34;&gt;htpasswd&lt;/a&gt; to protect static files, and it’s far from optimal. I &lt;strong&gt;don’t&lt;/strong&gt; want to know or manage users’ passwords. I &lt;strong&gt;don’t&lt;/strong&gt; want them to remember a new ID. I just want to allow specific people to log in via their Google Accounts. (OpenID is too &lt;a href=&#34;http://www.gibdon.com/2008/06/openid-is-confusing.html&#34;&gt;confusing&lt;/a&gt;, and most people &lt;a href=&#34;http://blog.stackoverflow.com/2010/04/openid-one-year-later/&#34;&gt;use Google anyway&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;The easiest option would be to use Google &lt;a href=&#34;http://appengine.google.com/&#34;&gt;AppEngine&lt;/a&gt;. But their &lt;a href=&#34;http://code.google.com/appengine/docs/billing.html&#34;&gt;new pricing&lt;/a&gt; worries me. Hosting on EC2 is expensive in the long run. All my hosting is now out of a shared &lt;a href=&#34;http://www.hostgator.com/&#34;&gt;Hostgator&lt;/a&gt; server that offers Apache and PHP.&lt;/p&gt;
&lt;p&gt;So, obviously, I wrote a library protects static files on Apache/PHP using OpenID.&lt;/p&gt;
&lt;h3 id=&#34;download-the-code&#34;&gt;&lt;a href=&#34;https://github.com/sanand0/protectstatic&#34;&gt;Download the code&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Say you want to protect &lt;code&gt;/home/www&lt;/code&gt; which is accessible at &lt;a href=&#34;http://example.com/&#34;&gt;http://example.com/&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Copy &lt;code&gt;.htaccess&lt;/code&gt; and &lt;code&gt;_auth/&lt;/code&gt; under &lt;code&gt;/home/www&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In .htaccess, change &lt;code&gt;RewriteBase&lt;/code&gt; to &lt;code&gt;/&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;code&gt;_auth/&lt;/code&gt;, copy &lt;code&gt;config.sample.php&lt;/code&gt; into &lt;code&gt;config.php&lt;/code&gt;, and&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;change &lt;code&gt;$AUTH_PATH&lt;/code&gt; to &lt;a href=&#34;http://example.com/&#34;&gt;http://example.com/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;add permitted email IDs to &lt;code&gt;function allow()&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, when you visit &lt;a href=&#34;http://example.com&#34;&gt;http://example.com&lt;/a&gt;, you’ll be taken to Google’s login page. Once you log in, if your email ID is allowed , you’ll be able to see the file.&lt;/p&gt;
&lt;p&gt;Feel free to try, or &lt;a href=&#34;https://github.com/sanand0/protectstatic&#34;&gt;fork the code&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;19 Nov 2011 10:31 am&lt;/em&gt;:
I could. But what I&amp;rsquo;ve learnt is that while the static content on this site has survived 14 years, moving from host to host, the same can&amp;rsquo;t be said of ANY of the apps I&amp;rsquo;ve written to create the site. I&amp;rsquo;ve moved from shell scripts to Perl to Python to node.js&amp;hellip; and something else will come up. I can&amp;rsquo;t maintain this stuff. Fortunately, HTML will stay.
So I&amp;rsquo;m making the content primary. I just have a bunch of static files, and that&amp;rsquo;s the key. This is an OPTIONAL library that sits on the side. Without it, the worst that&amp;rsquo;ll happen is that the content becomes public. But otherwise, all URLs will remain unbroken. That&amp;rsquo;s a big win with this approach.
That&amp;rsquo;s also the reason I rejected AppEngine. For my volume of usage, pricing isn&amp;rsquo;t a serious issue. It&amp;rsquo;s simplicity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.reviewgang.com&#34;&gt;Manu&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;19 Nov 2011 5:59 am&lt;/em&gt;:
If you are willing to host it outside, then heroku allows one free instance per project.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.s-anand.net/&#34;&gt;S Anand&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;2 Dec 2011 10:09 pm&lt;/em&gt;:
I too will probably stay on WordPress for a while. But recently, I&amp;rsquo;ve been creating quite a few microblogs for various topics, and find that the workflow of Markdown -&amp;gt; Dropbox -&amp;gt; PHP -&amp;gt; HTML far too compelling to ignore. It&amp;rsquo;s worked quite well from an ease of publishing perspective. I&amp;rsquo;m still ironing out few edges. Will publish once I do.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://thejeshgn.com&#34;&gt;Thejesh GN&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;25 Nov 2011 11:56 am&lt;/em&gt;:
I was planning to move to static using &lt;a href=&#34;http://www.blogofile.com/&#34;&gt;http://www.blogofile.com/&lt;/a&gt; (python and variety of templating systems are supported). But I am still betting on wordpress for many things. One day I will probably move to static blog.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://chmd.fr&#34;&gt;Christophe-Marie Duquesne&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;22 Dec 2013 12:53 pm&lt;/em&gt;:
Hi,
Your post inspired me to write a lighttpd magnet script that protects content regardless of its nature (static or dynamic). I use it:
&lt;ul&gt;
&lt;li&gt;for protecting my (static) photo gallery and only giving access to people I select&lt;/li&gt;
&lt;li&gt;for protecting my (dynamic) rss reader and only giving access to myself&lt;/li&gt;
&lt;li&gt;for protecting my (dynamic) online file manager and only giving access to my girlfriend and myself.
It is completely pluggable, and it sets the REMOTE_USER server variable so that user-aware applications can use this mechanism to authentify you.
&lt;a href=&#34;https://lighttpd-external-auth.chmd.fr/&#34;&gt;https://lighttpd-external-auth.chmd.fr/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Server speed benchmarks</title>
      <link>https://www.s-anand.net/blog/server-speed-benchmarks/</link>
      <pubDate>Sat, 12 Mar 2011 08:23:44 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/server-speed-benchmarks/</guid>
      <description>&lt;p&gt;Yesterday, &lt;a href=&#34;https://www.s-anand.net/blog/why-node-js/&#34;&gt;I wrote about&lt;/a&gt; &lt;a href=&#34;http://nodejs.org/&#34;&gt;node.js&lt;/a&gt; being fast. Here are some numbers. I ran Apache Benchmark on the simplest Hello World program possible, testing 10,000 requests with 100 concurrent connections (&lt;code&gt;ab -n 10000 -c 100&lt;/code&gt;). These are on my Dell E5400, with &lt;a href=&#34;https://www.s-anand.net/blog/software-update/&#34;&gt;lots of application&lt;/a&gt; running, so take them with a pinch of salt.&lt;/p&gt; &lt;table border=&#34;0&#34; cellspacing=&#34;0&#34; cellpadding=&#34;2&#34; width=&#34;601&#34;&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign=&#34;top&#34; width=&#34;288&#34;&gt;PHP5 on Apache 2.2.6&lt;br&gt;&lt;code&gt;&amp;lt;?php echo “Hello world” ?&amp;gt;&lt;/code&gt;&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;56&#34;&gt;1,550/sec&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;255&#34;&gt;Base case. But this isn’t too bad&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign=&#34;top&#34; width=&#34;288&#34;&gt;Tornado/Python&lt;br&gt;See &lt;a href=&#34;http://www.tornadoweb.org/&#34;&gt;Tornadoweb&lt;/a&gt; example&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;56&#34;&gt;1,900/sec&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;255&#34;&gt;Over 20% faster&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign=&#34;top&#34; width=&#34;288&#34;&gt;Static HTML on Apache 2.2.6&lt;br&gt;&lt;code&gt;Hello world&lt;/code&gt;&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;56&#34;&gt;2,250/sec&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;255&#34;&gt;Another 20% faster&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign=&#34;top&#34; width=&#34;288&#34;&gt;Static HTML on nginx 0.9.0&lt;br&gt;&lt;code&gt;Hello world&lt;/code&gt;&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;56&#34;&gt;2,400/sec&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;255&#34;&gt;6% faster&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign=&#34;top&#34; width=&#34;288&#34;&gt;node.js 0.4.1&lt;br&gt;See &lt;a href=&#34;http://nodejs.org/&#34;&gt;nodejs.org&lt;/a&gt; example&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;56&#34;&gt;2,500/sec&lt;/td&gt; &lt;td valign=&#34;top&#34; width=&#34;255&#34;&gt;Faster than a static file on nginx!&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt;I was definitely NOT expecting this result… but it looks like serving a static file with node.js could be faster than nginx. This might explain why &lt;a href=&#34;http://markup.io/&#34;&gt;Markup.io&lt;/a&gt; is &lt;a href=&#34;http://web-sniffer.net/?url=markup.io&amp;amp;type=HEAD&#34;&gt;exposing node.js directly&lt;/a&gt;, without an nginx or varnish proxy.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Olivier&lt;/strong&gt; &lt;em&gt;12 Dec 2011 3:39 am&lt;/em&gt;:
Nginx has to read the file from the disk each time.
Nodejs has the content of the file in memory.
So it&amp;rsquo;s normal that nodejs is faster than Nginx. Re-test the same thing but setup Nginx so it caches files in RAM and you&amp;rsquo;ll see the truth.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Seamsky&lt;/strong&gt; &lt;em&gt;4 Jun 2013 11:31 pm&lt;/em&gt;:
Please, use &amp;ldquo;return 200 &amp;lsquo;Hello world&amp;rsquo;;&amp;rdquo; for nginx instead of serving file from hard drive.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Install XAMPP</title>
      <link>https://www.s-anand.net/blog/install-xampp/</link>
      <pubDate>Wed, 14 Jul 2010 05:23:29 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/install-xampp/</guid>
      <description>&lt;p&gt;I’ve been going around setting up open source software a fair bit recently. To minimise the pain of explaining it, I’m putting together a short videos that explain the process.&lt;/p&gt; &lt;p&gt;Here’s the first, on &lt;a href=&#34;www.apachefriends.org/en/xampp-windows.html&#34;&gt;XAMPP&lt;/a&gt;, which is a starting point for most open source applications. It bundles Apache (web server), MySQL (database), Perl and PHP.&lt;/p&gt; &lt;p&gt;To install it, search and download “XAMPP for Windows”, and press enter for every question. Then install your application under C:\xampp\htdocs. That’s it.&lt;/p&gt; &lt;p&gt;&lt;object width=&#34;600&#34; height=&#34;475&#34;&gt;&lt;param name=&#34;movie&#34; value=&#34;http://www.youtube.com/v/cT0LwR1WmM8&amp;amp;hl=en_GB&amp;amp;fs=1&#34;&gt;&lt;/param&gt;&lt;param name=&#34;allowFullScreen&#34; value=&#34;true&#34;&gt;&lt;/param&gt;&lt;param name=&#34;allowscriptaccess&#34; value=&#34;always&#34;&gt;&lt;/param&gt;&lt;embed src=&#34;http://www.youtube.com/v/cT0LwR1WmM8&amp;amp;hl=en_GB&amp;amp;fs=1&#34; type=&#34;application/x-shockwave-flash&#34; allowscriptaccess=&#34;always&#34; allowfullscreen=&#34;true&#34; width=&#34;600&#34; height=&#34;475&#34;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://chandoo.org/wp/&#34;&gt;Chandoo&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;14 Jul 2010 11:32 am&lt;/em&gt;:
Good one..
Recently I had to install XAMP (no need for Perl, yet..) and I went with Windows Platform Installer. Found it much more simple and easy&amp;hellip; &lt;a href=&#34;http://www.microsoft.com/web/downloads/platform.aspx&#34;&gt;http://www.microsoft.com/web/downloads/platform.aspx&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Short URLs</title>
      <link>https://www.s-anand.net/blog/short-urls/</link>
      <pubDate>Sat, 11 Apr 2009 18:59:45 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/short-urls/</guid>
      <description>&lt;p&gt;With &lt;a href=&#34;http://joshua.schachter.org/2009/04/on-url-shorteners.html&#34;&gt;all&lt;/a&gt; &lt;a href=&#34;http://laughingmeme.org/2009/04/03/url-shortening-hinting/&#34;&gt;the&lt;/a&gt; &lt;a href=&#34;http://www.scripting.com/stories/2009/03/07/solvingTheTinyurlCentraliz.html&#34;&gt;discussion&lt;/a&gt; around &lt;a href=&#34;http://en.wikipedia.org/wiki/List_of_URL_redirection_services&#34;&gt;URL shorteners&lt;/a&gt;, &lt;a href=&#34;http://digg.com/tools/diggbar&#34;&gt;Diggbar&lt;/a&gt;, &lt;a href=&#34;http://daringfireball.net/2009/04/how_to_block_the_diggbar&#34;&gt;blocking&lt;/a&gt; &lt;a href=&#34;http://farukat.es/journal/2009/04/225-javascript-diggbar-killer-not-blocker&#34;&gt;it&lt;/a&gt;, and the &lt;a href=&#34;http://revcanonical.appspot.com/&#34;&gt;rev&lt;/a&gt;=&lt;a href=&#34;http://twitter.com/kevinmarks/status/1448424167&#34;&gt;canonical&lt;/a&gt; proposal, I decided to implement a URL shortening service on this blog with the least effort possible. This probably won’t impact you just yet, but when &lt;a href=&#34;http://simonwillison.net/2009/Apr/11/revcanonical/&#34;&gt;tools&lt;/a&gt; become more popular and sophisticated, it would hopefully eliminate the need for &lt;a href=&#34;http://tinyurl.com/&#34;&gt;tinyurl&lt;/a&gt;, &lt;a href=&#34;http://bit.ly/&#34;&gt;bit.ly&lt;/a&gt;, etc.&lt;/p&gt;
&lt;p&gt;Since the blog runs on &lt;a href=&#34;http://wordpress.org/&#34;&gt;WordPress&lt;/a&gt;, every post has an ID. The short URL for any post will simply be &lt;code&gt;http://www.s-anand.net/the_ID&lt;/code&gt;. For example, &lt;code&gt;http://s-anand.net/17&lt;/code&gt; is a link to post on &lt;a href=&#34;https://www.s-anand.net/blog/ubuntu-8-10-on-a-dell-latitude-d420/&#34;&gt;Ubuntu on a Dell Latitude D420&lt;/a&gt;. At 21 characters, it’s roughly the same size as most &lt;a href=&#34;http://dooleyonline.typepad.com/dooley_post/2009/02/comparison-of-url-shorteners.html&#34;&gt;URL shorteners&lt;/a&gt; could make it.&lt;/p&gt;
&lt;p&gt;The code is easy: just one line added to index.php:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;link rev=&amp;quot;canonical&amp;quot; href=&amp;quot;http://s-anand.net/&amp;lt;?php the_ID(); ?&amp;gt;&amp;quot;&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;… and one line in my .htaccess:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;RewriteRule ^([0-9]+)$ blog/?p=$1 [L,R=301,QSA]&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Hopefully someone will come up with a WordPress plugin some time soon that does this. Until then, this should work for you.&lt;/p&gt;
</description>
    </item>
    <item>
      <title>WordPress themes on Live Writer</title>
      <link>https://www.s-anand.net/blog/wordpress-themes-on-windows-live-writer/</link>
      <pubDate>Sun, 08 Mar 2009 01:27:20 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/wordpress-themes-on-windows-live-writer/</guid>
      <description>&lt;p&gt;One of the reasons I moved to WordPress was the ability to write posts offline, for which I use &lt;a href=&#34;http://download.live.com/writer&#34;&gt;Windows Live Writer&lt;/a&gt; most of the time. The beauty of this is that I can preview the post &lt;strong&gt;exactly&lt;/strong&gt; as it will appear on my site. Nothing else that I know is as &lt;a href=&#34;http://en.wikipedia.org/wiki/WYSIWYG&#34;&gt;WYSIWYG&lt;/a&gt;, and it’s very useful to be able to type knowing exactly where each word will be.&lt;/p&gt;
&lt;p&gt;The only hitch is: if you write your own &lt;a href=&#34;http://wordpress.org/extend/themes/&#34;&gt;WordPress theme&lt;/a&gt;, Live Writer probably won’t be able to detect your theme — unless you’re an expert theme writer.&lt;/p&gt;
&lt;p&gt;I hunted on Google to see how to get my theme to work with Live Writer. I didn’t find any tutorials. So after a bit of hit-and-miss, I’m sharing a quick primer of what worked for me. If you don&amp;rsquo;t want to go through the hassle, you can always call on professionals who are adept at services like &lt;a href=&#34;https://www.littlebluedeerdesign.com/&#34;&gt;professional custom website design&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Open any post on your blog (using your new theme) and save that as &lt;code&gt;view.html&lt;/code&gt; in your theme folder. Now replace the page’s title with {post-title} and the page’s content with {post-body}. For example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;h1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;{post-title}&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;h1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;{post-body}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the file Live Writer will be &lt;a href=&#34;http://msdn.microsoft.com/en-us/library/bb463261.aspx&#34;&gt;using as its theme&lt;/a&gt;. This page will be displayed exactly as it is by Live Writer, with {post-title} and {post-body} replaced with what you type. You can put in anything you want in this page — but at least make sure you include your CSS files.&lt;/p&gt;
&lt;p&gt;To let Live Writer know that &lt;code&gt;view.html&lt;/code&gt; is what it should display, copy WordPress’ &lt;code&gt;/wp-includes/wlw-manifest.xml&lt;/code&gt; to your theme folder and add the following lines just before &lt;code&gt;&amp;lt;/manifest&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;WebLayout
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&#34;http://msdn.microsoft.com/en-us/library/bb463263.aspx&#34;&gt;Live Writer searches for wlmanifest.xml&lt;/a&gt; in the &lt;code&gt;&amp;lt;link rel=&amp;quot;wlmanifest&amp;quot;&amp;gt;&lt;/code&gt; tag of your home page. Since WordPress already links to its default &lt;code&gt;wlwmanifest.xml&lt;/code&gt;, we need remove that link and add our own. So add the following code to your &lt;code&gt;functions.php&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-php&#34; data-lang=&#34;php&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;my_wlwmanifest_link&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;echo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;s1&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;remove_action&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;wp_head&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;wlwmanifest_link&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;add_action&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;wp_head&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;my_wlwmanifest_link&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That’s it. Now if you add your blog to Live Writer, it will automatically detect the theme.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://yuntian.name/?p=228&#34;&gt;Windows Live Writer 向 DEDECMS 发文章 | 快乐生活，快乐工作&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;30 Apr 2009 8:39 am&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] WordPress themes on Live Writer [&amp;hellip;]&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.websitesare.us&#34;&gt;San Diego Web Design&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;22 Jun 2009 9:04 pm&lt;/em&gt;:
Note to my first post as it doesn&amp;rsquo;t show correctly:
What I did is I ended up adding the part between the tags to the regular wlwmanifest.xlm file.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://goodinformation&#34;&gt;vivek&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;15 Jun 2009 6:23 am&lt;/em&gt;:
Hi,
Thanks great information&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.websitesare.us&#34;&gt;San Diego Web Design&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;22 Jun 2009 9:02 pm&lt;/em&gt;:
Thank you, thank you, thank you! I was trying for hours to fix this before I found your post! Actually, the way you described it didn&amp;rsquo;t exactly work for me (I guess I did something wrong with the paths), but I ended up just adding the
WebLayout
with the absolute path to the regular wlwmanifest.xlm inside the includes folder and now it works!
Thanks again, your post was the only one describing this problem and helping me fix it!&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;shawn&lt;/strong&gt; &lt;em&gt;29 Jan 2010 7:37 pm&lt;/em&gt;:
I was having this issue today and came across this page. I came up with a very simple fix that requires no coding.
When setting up your blog in WLW, go to your admin settings in the wordpress dashboard and temporarily set your &amp;ldquo;Reading&amp;rdquo; settings to &amp;ldquo;Front page displays -&amp;gt; Your latest posts &amp;ldquo;. WLW will successfully download the theme, then set your Front page displays back to your custom setting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.zimmi.cz&#34;&gt;zimmi&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;27 Jan 2010 7:53 pm&lt;/em&gt;:
What if it still doesn&amp;rsquo;t work? Anything else I can try?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;S&lt;/strong&gt; &lt;em&gt;15 Jul 2010 5:45 pm&lt;/em&gt;:
Thank you so much!!!!!!!!!! this worked.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.girls-information.com&#34;&gt;girls information&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;27 Sep 2010 7:19 am&lt;/em&gt;:
this worked for me tanks for sharing&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.eyes2design.com/flogging-and-blogging/graphene-child-themes-and-live-writer&#34;&gt;Graphene, Child Themes, and Live Writer - Eyes2Design&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;28 Jul 2012 4:57 am&lt;/em&gt; &lt;em&gt;(pingback)&lt;/em&gt;:
[&amp;hellip;] came across this page by &lt;a href=&#34;https://www.s-anand.net&#34;&gt;www.s-anand.net&lt;/a&gt; which helped me a lot in understanding how Live Writer and WordPress get along together. So follow [&amp;hellip;]&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
