<?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>Scott Yang's Playground &#187; PHP</title>
	<atom:link href="http://scott.yang.id.au/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://scott.yang.id.au</link>
	<description>Faith, Technology and Randomness in Life, According to Scott</description>
	<lastBuildDate>Mon, 05 Jul 2010 05:16:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Stuck</title>
		<link>http://scott.yang.id.au/2007/05/stuck/</link>
		<comments>http://scott.yang.id.au/2007/05/stuck/#comments</comments>
		<pubDate>Mon, 28 May 2007 05:09:41 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2007/05/stuck/</guid>
		<description><![CDATA[On the left hand side, we have multiple vulnerabilities with PHP release 5.2.1 or less. Remote attackers might be able to exploit these issues in PHP applications making use of the affected functions, potentially resulting in the execution of arbitrary code, Denial of Service, execution of scripted contents in the context of the affected site, [...]]]></description>
			<content:encoded><![CDATA[<p>On the left hand side, we have <a href="http://www.gentoo.org/security/en/glsa/glsa-200705-19.xml">multiple vulnerabilities</a> with PHP release 5.2.1 or less.</p>
<blockquote><p>Remote attackers might be able to exploit these issues in PHP applications making use of the affected functions, potentially resulting in the execution of arbitrary code, Denial of Service, execution of scripted contents in the context of the affected site, security bypass or information leak.</p></blockquote>
<p>On the right hand side, we have <a href="http://www.mail-archive.com/internals@lists.php.net/msg27608.html">HTTP_RAW_POST_DATA bug in PHP 5.2.2</a>.</p>
<blockquote><p>So <code>$GLOBALS['HTTP_RAW_POST_DATA']</code> is not set. The <code>PEAR::XML_RPC</code> package actually uses <code>$HTTP_RAW_POST_DATA</code> on the receiving end, but that doesn&#8217;t appear to be set either. And the <code>always_populate_raw_post_data</code> option in php.ini doesn&#8217;t make a difference.</p></blockquote>
<p>That means, any PHP code that assumes the existence of <code>$HTTP_RAW_POST_DATA</code> will simply fail as that variable is no longer populated. With all the API, web services, etc, there are actually many applications that use raw post data, which could be XML, JSON, or any other package formats. Pingbacks simply won&#8217;t work in WordPress, although WP 2.2 has a work around on this PHP 5.2.2 bug.</p>
<p>So I basically upgraded all my servers to PHP 5.2.2 early last week. found many web services code I wrote were broken, and was forced to revert back to vulnerable PHP 5.2.1. The bug <a href="http://bugs.php.net/bug.php?id=41293">has been fixed and there&#8217;s a work around</a>, but I would rather wait for 5.2.3 to hit the street, which I hope to be sooner than later.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2007/05/stuck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Permalink Redirect 0.6.2 Released</title>
		<link>http://scott.yang.id.au/2007/02/permalink-redirect-062-released/</link>
		<comments>http://scott.yang.id.au/2007/02/permalink-redirect-062-released/#comments</comments>
		<pubDate>Thu, 01 Feb 2007 04:11:17 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2007/02/permalink-redirect-062-released/</guid>
		<description><![CDATA[Did I just say all my WordPress plugins seem to work fine with WordPress 2.1? It turns out one of the new features in WP2.1, where you can set any static page as the front page, will send your browser into a busy redirection loop, when you turn on Permalink Redirect plugin. Well. The bug [...]]]></description>
			<content:encoded><![CDATA[<p>Did I just say all my WordPress plugins <a href="http://scott.yang.id.au/2007/01/upgraded-to-wordpress-21-ella/">seem to work fine with WordPress 2.1</a>? It turns out one of the new features in WP2.1, where you can set any static page as the front page, will send your browser into a busy redirection loop, when you turn on <a href="http://scott.yang.id.au/code/permalink-redirect/">Permalink Redirect plugin</a>.</p>
<p>Well. The bug has been fixed now, and it is now <strong>0.6.2</strong>. Go and download it if you are using WP2.1&#8242;s new feature.</p>
<p>Thanks to Brian for pointing it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2007/02/permalink-redirect-062-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Performance Comparison with 6 Leading Web Frameworks</title>
		<link>http://scott.yang.id.au/2007/01/performance-comparison-with-6-leading-web-frameworks/</link>
		<comments>http://scott.yang.id.au/2007/01/performance-comparison-with-6-leading-web-frameworks/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 00:02:03 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2007/01/performance-comparison-with-6-leading-web-frameworks/</guid>
		<description><![CDATA[Alrond&#8217;s technoblog: The performance test of 6 leading frameworks. Very interesting read, as Alrond tested Django (Python), TurbGears (Python), Ruby on Rails 1.1.6/1.2.1 (Ruby), Catalyst (Perl), Code Igniter (PHP) and Symfony (PHP), using various load and memory testing utilities. His conclusion? Django is fast, and can be very light on memory as well. RoR 1.1.6 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/">Alrond&#8217;s technoblog: The performance test of 6 leading frameworks</a>. Very interesting read, as Alrond tested <a href="http://www.djangoproject.com/">Django</a> (Python), <a href="http://www.turbogears.org/">TurbGears</a> (Python), <a href="http://rubyonrails.org/">Ruby on Rails</a> 1.1.6/1.2.1 (Ruby), <a href="http://www.catalystframework.org/">Catalyst</a> (Perl), <a href="http://www.codeigniter.com/">Code Igniter</a> (PHP) and <a href="http://www.symfony-project.com/">Symfony</a> (PHP), using various load and memory testing utilities. His conclusion?</p>
<ul>
<li>Django is fast, and can be very light on memory as well.</li>
<li>RoR 1.1.6 is significantly faster than 1.2.1, which was a bit disappointing.</li>
<li>PHP frameworks can be very slow, unless a opcode cache is used.</li>
<li>Symfony is way too complex and too slow.</li>
</ul>
<p>Alright, I guess after all performance is only half the story, and I am pretty sure the RoR guys are willing to trade performance with speed of development. Lucky for the Python guys that they can have both.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2007/01/performance-comparison-with-6-leading-web-frameworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ohloh: PHP and Ruby Comparison</title>
		<link>http://scott.yang.id.au/2006/10/ohloh-php-and-ruby-comparison/</link>
		<comments>http://scott.yang.id.au/2006/10/ohloh-php-and-ruby-comparison/#comments</comments>
		<pubDate>Thu, 26 Oct 2006 01:45:10 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2006/10/ohloh-php-and-ruby-comparison/</guid>
		<description><![CDATA[Ohloh: PHP Eats Rails for Breakfast. A clearly link bait title, as it is in fact analysing by the &#8220;language&#8221;, i.e. PHP vs. Ruby, instead of frameworks. However, the analysis is interesting. As well as Brad Feld&#8217;s feedback on this article. Some of my thoughts: I won&#8217;t say it represents the &#8220;big picture&#8221;. Ohloh is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ohloh.com/wiki/articles/php_eats_rails">Ohloh: PHP Eats Rails for Breakfast</a>. A clearly link bait title, as it is in fact analysing by the &#8220;language&#8221;, i.e. <a href="http://www.php.net/">PHP</a> vs. <a href="http://www.ruby-lang.org/">Ruby</a>, instead of frameworks. However, the analysis is interesting. As well as <a href="http://www.feld.com/blog/archives/002016.html">Brad Feld&#8217;s feedback</a> on this article.</p>
<p>Some of my thoughts:</p>
<ul>
<li>
<p>I won&#8217;t say it represents the &#8220;big picture&#8221;. Ohloh is only indexing open source projects from major source code forges, and 3,000 projects certainly sound small in comparison to the scope of open source world.</p>
<p>Moreover, Ohloh indexing on the open source projects that they have access to, and proprietary software is yet another world. Majority of SaaS/ASP projects never release their source code, even though they are popping up all over the place because of this Web 2.0 boom. Many are developed using open source languages and frameworks.</p>
<p>Stating &#8220;PHP Eats Rails for Breakfast&#8221; is far away from truth.</p>
</li>
<li>
<p><img src="http://scott.yang.id.au/file/images/ohloh_metrics_20061016_2.png" alt="Ohloh PHP vs Ruby for new projects" style="float:right;margin:0 0 5px 12px;"/> PHP is a language, but most, if not all open source projects are for the web. Rails is a framework, but there are many Ruby projects that (1) don&#8217;t depend on Rails (2) aren&#8217;t serving the web. And the world is more than just the web.</p>
<p>I think it somehow affects the last graph which shows the number of new projects. I have seen quite a few useful Ruby apps that have nothing to do with Rails, runs from the command line, and are small because of expressiveness of Ruby.</p>
</li>
<li>
<p>Another interesting observation from that graph is, number of new projects in Ruby actually surpasses all the <strong>P&#8217;s</strong> (Python, PHP and Perl) at around the same time between 2003 and 2004, if I am reading the graph correctly. But <a href="http://www.loudthinking.com/">DHH</a> did not even release the first public version of RoR until mid 2004, which arguably was the push that created the momentum behind Ruby today.</p>
<p>Hmm. I am confused. So there are already more new projects done in Ruby <strong>before</strong> Rails was announced?</p>
</li>
<li>
<p>Looks like the real looser here is Perl. How come no one is talking about it?</p>
</li>
</ul>
<p>The bottom line is, the data revealed in the comparison does not really prove what its title has suggested. What people put on SourceForge also does not tell us what the world is using, especially when a lot of software has moved to SaaS model.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2006/10/ohloh-php-and-ruby-comparison/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gravatar Cache 0.1 Released</title>
		<link>http://scott.yang.id.au/2006/05/gravatar-cache-01-released/</link>
		<comments>http://scott.yang.id.au/2006/05/gravatar-cache-01-released/#comments</comments>
		<pubDate>Sat, 27 May 2006 13:35:47 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[Gravatar]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2006/05/gravatar-cache-01-released/</guid>
		<description><![CDATA[Last couple of nights I have hacked a generic URL-based cache for Gravatar, the globally recognized avatar. If you have been blogging or reading other people&#8217;s blog, &#8220;gravatar&#8221; would not be foreign to you, as it has been implemented on many blog sites of various platforms. Gravatar Cache is an implementation to cache both positive [...]]]></description>
			<content:encoded><![CDATA[<p>Last couple of nights I have hacked a generic URL-based cache for <a href="http://www.gravatar.com/">Gravatar</a>, the globally recognized avatar. If you have been blogging or reading other people&#8217;s blog, &#8220;gravatar&#8221; would not be foreign to you, as it has been implemented on many blog sites of various platforms. <a href="http://scott.yang.id.au/code/gravatar-cache/">Gravatar Cache</a> is an implementation to cache both positive and negative response. Moreover, if positive cache is served, PHP script is not invoked as cache is served directly from the web server.</p>
<p>I have also added gravatar onto the comments section of FuCoder.com, utilising the gravatar cache. Cache is served from another server &#8212; not DreamHost but a VPS I rented from <a href="http://www.unixshell.com/">unixshell#</a> running Gentoo + lighttpd. We&#8217;ll see how it goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2006/05/gravatar-cache-01-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#8212; Good or Bad?</title>
		<link>http://scott.yang.id.au/2006/02/php-good-or-bad/</link>
		<comments>http://scott.yang.id.au/2006/02/php-good-or-bad/#comments</comments>
		<pubDate>Thu, 23 Feb 2006 06:18:47 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2006/02/php-good-or-bad/</guid>
		<description><![CDATA[It all starts with Tim Bray&#8217;s little rant on PHP a few days ago. Tim can&#8217;t stand PHP, because &#8230;all the PHP code I&#8217;ve seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places. I have seen some [...]]]></description>
			<content:encoded><![CDATA[<p>It all starts with <a href="http://www.tbray.org/ongoing/When/200x/2006/02/17/PHP">Tim Bray&#8217;s little rant on PHP</a> a few days ago. Tim can&#8217;t stand PHP, because</p>
<blockquote><p>
  &#8230;all the PHP code I&#8217;ve seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places.
</p></blockquote>
<p>I have seen some well designed PHP code, but generally Tim&#8217;s observation stands valid.</p>
<p>The problem is more than wild spread of spaghetti PHP code found in many open source applications. Programs are bounded to be a mess if they are not <em>designed</em>, but were <em>hacked together</em> by non-programmers trying to quickly (and often temporarily) fill his/her needs. Nothing wrong with that &#8212; you can write spaghetti code in every language of your choice (debugging spaghetti <a href="http://www.python.org/">Python</a> is part of my daily job). In fact it might be a compliment to PHP as it is just so easy to get up and running. Even a non-programmer can add a bit of &#8220;dynamics&#8221; to his/her own website, without begging/paying the professionals.</p>
<p>Things only get messy when your temporary &#8220;Hello World&#8221; application starts to need database support, need to manage large XML documents, need to talk in different charsets, and need to scale to hundreds of requests per second.</p>
<p>However, what I see the fundamental problem of PHP is not that there are zillions lines of messy code out there, but the <strong>language</strong> itself. Scanning through Tim&#8217;s comment list, two other posts caught my eyes.</p>
<p>First of all, <a href="http://maurus.net/work/php-sucks/">Jonas Maurus wrote &#8220;PHP sucks&#8221;</a>. It&#8217;s a bit technical, but I very much agree with what he has said. There are simply too many &#8220;warts&#8221; in PHP-land that can catch even a seasoned developer by surprise. For example the pass by reference difference between PHP4 and PHP5, and you usually need to use === (3 equal signs) to correctly validate the value as <em>boolean false</em>.</p>
<p>Another nice write up about PHP language comes from Aristotle Pagaltzis &#8212; &#8220;<a href="http://plasmasturm.org/log/393/">Why PHP is good but bad</a>&#8220;. I especially agree with the point &#8220;The easy, obvious way to do things is often the incorrect one&#8221;.</p>
<blockquote><p>
  There are lots of tutorials which will either not tell you to quote user input before interpolating it into SQL statements at all, or tell you to use <code>addslashes</code> for the purpose. In either case you are open to injection attacks &#8212; either gaping wide or just wide&#8230;
</p></blockquote>
<p>What annoys me is, there are way too many PHP programmers (who probably have no other SQL experience) automatically assume &#8216;<code>addslashes</code>&#8216; with escaping in SQL string literal, and subsequently think that they are safe from SQL injection by adding slashes everywhere in their SQL concatenations. Related &#8220;magic quote&#8221; that gets applied to all incoming GET/POST/Cookie data also does more voodoo than good.</p>
<p>And Aristotle concluded the problem with PHP:</p>
<blockquote><p>
  &#8230; the morass is simply the result of the language being a templating system that grew too big for its breeches. I don.t believe the problems can be corrected in any sensible fashion; PHP will always be a templating system, however much it may be straining against its clothes.
</p></blockquote>
<p>Yes &#8212; it was initially designed as a <em>template language</em> that grew out from Perl CGI scripts. New functions were added onto a flat name space so they can be easily called from inside the templates. It is working hard to become a full object oriented language itself, but the baggage was still very visible.</p>
<hr/>
<p>On the other hand, you have Harry Fuecks <a href="http://www.sitepoint.com/blogs/2006/02/21/a-pro-php-rant/">having his pro-PHP rant</a>. &#8220;Shared nothing&#8221; has been one of his main argument why PHP is scalable. And it works &#8212; with Apache and mod_php &#8212; as the web development platform it was designed to be.</p>
<p>&#8220;Shared nothing&#8221; being scalable is quite arguable, and I believe it really depends on the application. Your clusters of Apache/PHP nodes pushes all states into database assuming that the DB is going to scale &#8212; that is a <em>very big assumption</em>. It only really works with applications with far more reading than writing, where you can easily set up clusters of slave DBs. But heh, it covers most of the &#8220;Web 2.0&#8243; style of applications and I guess that&#8217;s what they care.</p>
<p>Moreover, &#8220;shared nothing&#8221; is a design philosophy that is not unique to PHP. I can have my JSP or Django with FastCGI, etc application that does exactly the same thing. Now, with other applications where a per-process in-memory cache would be very useful, what option do I have with PHP? Most caching options I have seen rely on external processes or external storage.</p>
<p>The rest of Harry&#8217;s article talks about how PHP plays catching up &#8212; generic database support (I was using <a href="http://dbi.perl.org/">Perl DBI</a> in 1997), SPL (how long have we had <a href="http://www.sgi.com/tech/stl/">STL</a>?), XML (finally!), Unicode (finally 2!), etc.</p>
<p>Language wise, I do not think PHP&#8217;s Schwarz is bigger. It is getting there, but I&#8217;ll rather code in Python or Ruby than PHP. The only redeeming value I see in PHP is &#8212; it <em>works</em> (most of the time). Thanks to mod_php that gets installed almost everywhere (and becoming a resource hog with Apache&#8217;s prefork MPM), your PHP application is most likely to run in the $10/month budget shared hosts.</p>
<hr/>
<p><a href="http://www.yahoo.com/">Yahoo</a>&#8216;s <a href="http://developer.yahoo.net/php/">PHP development centre</a> has just gone live. It is not hard to see that PHP has got Yahoo as its backing. Well, they have <a href="http://lerdorf.com/">Rasmus</a> &#8212; maybe that&#8217;s why. At the same time, Google has got <a href="http://www.python.org/~guido/">Guido</a>. Interesting competition ahead :)</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2006/02/php-good-or-bad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ease of Deployment Matters</title>
		<link>http://scott.yang.id.au/2006/01/ease-of-deployment-matters/</link>
		<comments>http://scott.yang.id.au/2006/01/ease-of-deployment-matters/#comments</comments>
		<pubDate>Fri, 06 Jan 2006 02:18:40 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2006/01/ease-of-deployment-matters/</guid>
		<description><![CDATA[Peter Hunt took a look on &#8220;How Python wins on the Web&#8221;. He argued that framework does not really matter &#8212; not all those efforts mimicking Ruby on Rails anyway, as RoR and .NET has already won the hearts of developers. Instead, Pythonists should focus on killer re-usable applications. Here&#8217;s what I propose: screw Web [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.aminus.org/blogs/index.php/phunt/2006/01/04/how_python_wins_on_the_web">Peter Hunt took a look on &#8220;How Python wins on the Web&#8221;</a>. He argued that <em>framework does not really matter</em> &#8212; not all those efforts mimicking Ruby on Rails anyway, as RoR and .NET has already won the hearts of developers. Instead, Pythonists should focus on killer re-usable applications.</p>
<blockquote><p>Here&#8217;s what I propose: screw Web frameworks for now. We won&#8217;t win in the Rails generation&#8230; For today, let&#8217;s work on making generic Python products. Let&#8217;s make a kick-ass community forums system, an incredible blogging system, a news script, a CPanel/Webmin clone that people will use because of their features, not their programming language.</p></blockquote>
<p>However, when you look around searching for re-usable open source web applications, what do you see? PHP applications. When you go to open source application directories like <a href="http://www.opensourcecms.com/">OpenSourceCMS</a>, most the apps (if not all) listed in there are written in PHP.</p>
<p>To me, PHP provides a gentler learning curve &#8212; you can easily add PHP tags to existing static HTML files to create dynamic sites. But so is many other Python-based template engines (like <a href="http://spyce.sourceforge.net/">Spyce</a>). The language itself is only so-so &#8212; Perl&#8217;ish, and probably has many more warts than Python, even in its current object-oriented incarnation. I do not think it is as attractive to the developers as 5 years ago when LAMP(HP) was the buzzword. However, PHP-developed applications still rule the market of cheap-ass shared hosting. Why?</p>
<p><strong>Ease of deployment.</strong></p>
<p>Peter said in his post:</p>
<blockquote><p>And, most importantly, let&#8217;s all get behind what I believe is the most pressing and important concept in the Python web development world today: <a href="http://pythonpaste.org/deploy/">Paste Deploy</a>. What Python needs more than anything is a brainless, quick-and-easy way of connecting applications to gateways.</p></blockquote>
<p><a href="http://wordpress.org/">WordPress</a> guys are proud of their <a href="http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install">famous 5 minute install</a>. Not just WordPress, there is simply &#8220;no step 3&#8243; in many PHP application installations. You upload files into your web-root, point the browser to <code>install.php</code>, and then just follow the steps to set up database, create configuration, initialise super user, etc. There is no need to compile your own Python executable to install easy install so you can download eggs to power your supa-dupa forum application downloaded from sourceforge&#8230;</p>
<p>But how do you get ease of deployment? I have no experience with <a href="http://pythonpaste.org/">Paste</a> before, so I briefly looked at the Deployment documentation. While it looks very promising, its installation goes like this:</p>
<pre>
<strong>sudo</strong> easy_install.py PasteDeploy
</pre>
<p>Aargh! It seems for those do no think paying for dedicated server or VPS is justifiable, they can only rely on their web hosts to install those libraries for them. Most hosting customers won&#8217;t have a clue on compiling their own Python, and it is unlikely that hosting companies will have every possible egg installed, unless there&#8217;s enough demand. There will not be demands unless there are enough compelling Python web applications. However, sometimes even a seasoned Python developer will choose to develop his next re-usable killer app in PHP, if he knows how difficult it will be to deploy&#8230;</p>
<p>At the end a good framework still matters. Ease of deployment is crucial, but is also a vicious cycle that needs some momentum to break out. RoR has that momentum &#8212; look at how many shared hosts are now claiming their support of RoR deployments. We only wish the same can be said about <a href="http://www.djangoproject.com/">Django</a> and <a href="http://www.turbogears.org/">TurboGears</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2006/01/ease-of-deployment-matters/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Faster PHP on Resin/JVM</title>
		<link>http://scott.yang.id.au/2005/12/faster-php-on-resinjvm/</link>
		<comments>http://scott.yang.id.au/2005/12/faster-php-on-resinjvm/#comments</comments>
		<pubDate>Thu, 22 Dec 2005 12:07:11 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2005/12/faster-php-on-resinjvm/</guid>
		<description><![CDATA[The Server Side reports Caucho adds PHP support to Resin to allow it to run up to 6 times faster. It is done by compiling PHP into Java bytecode so that it can be executed in highly optimised Java virtual machines. From this comment, Quercus (the PHP module for Resin application server) actually implemented most [...]]]></description>
			<content:encoded><![CDATA[<p>The Server Side reports <a href="http://www.theserverside.com/news/thread.tss?thread_id=38144">Caucho adds PHP support to Resin to allow it to run up to 6 times faster</a>. It is done by compiling PHP into Java bytecode so that it can be executed in highly optimised Java virtual machines.</p>
<p>From <a href="http://www.theserverside.com/news/thread.tss?thread_id=38144#194481">this comment</a>, Quercus (the PHP module for Resin application server) actually implemented most of the PHP API&#8217;s (which is massive) to provide compatibility, and even their own Mantis bug tracker, an <a href="http://www.mantisbt.org/">open source</a> PHP app, is now running on their Java platform.</p>
<p><b>Nice!</b></p>
<p>I guess it would be more of a threat to other PHP accelerators like <a href="http://www.php-accelerator.co.uk/">PHPA</a> and <a href="http://www.zend.com/">Zend</a>. PHP&#8217;s poor performance is obvious in large applications &#8212; every script is parsed and compiled <strong>everytime</strong> it is executed, and many of those accelerators provide nothing but bytecode cache to save on the parsing and compilation time. Now there&#8217;s another platform that does on-demand compilation.</p>
<p>However, I guess it is more than just caching the bytecode. What makes PHP on Java fast is actually the VM itself. We cannot deny that JVM is probably one of the fastest and most well-optimised VM out there, and JVM bytecodes are usually dynamically compiled into native code in JIT. The same can be said about the .NET&#8217;s CLR &#8212; a well optimised VM can sometimes run close to native code speed.</p>
<p>Therefore sometimes I wonder whether it is a better idea to compile your language as bytecode to run on a well-optimised VM, than spend time coding the actual virtual machine to run your intepreted scripting language. As a Python programmer (not yet a hyper-enthusiasts), I am interested in projects like <a href="http://codespeak.net/pypy/">PyPy</a>, <a href="http://www.jython.org/">Jython</a> and <a href="http://www.ironpython.com/">IronPython</a> that might eventually and constantly out-perform CPython.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2005/12/faster-php-on-resinjvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Andreessen on Java and PHP</title>
		<link>http://scott.yang.id.au/2005/10/andreessen-java-php/</link>
		<comments>http://scott.yang.id.au/2005/10/andreessen-java-php/#comments</comments>
		<pubDate>Thu, 20 Oct 2005 06:08:17 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2005/10/30/</guid>
		<description><![CDATA[Via ZDNet News, Marc Andreessen of former Netscape endorse PHP over Java for website development, because it is open source, having easier environment, widely used and have big companies behind it. Interesting description about Java: Java is much more programmer-friendly than C or C++, or was for a few years there until they made just [...]]]></description>
			<content:encoded><![CDATA[<p>Via ZDNet News, <a href="http://news.zdnet.com/2100-9593_22-5903187-2.html">Marc Andreessen of former Netscape endorse PHP</a> over Java for website development, because it is open source, having easier environment, widely used and have big companies behind it.</p>
<p>Interesting description about Java:</p>
<blockquote><p>Java is much more programmer-friendly than C or C++, or was for a few years there until they made just as complicated. It&#8217;s become arguably even harder to learn than C++&#8230;</p></blockquote>
<p><em>How true!</em> Java, the language itself, is simple and easy to understand &#8212; at least the first few incarnation of it. However, over the years when the standard JDK gets bigger and bigger to download, the built-in libraries gets incredibly huge, and just the sheer complexity to set up a J2EE server. It has turned itself into a beast now, and no one now can claim that he knows the &#8220;Java API&#8221;. Which one? You ask.</p>
<p>Or maybe it is just me who cannot get my head wrapped around Java. Used to make my living in Java 5 years ago, but am too scared to touch it now.</p>
<p>PHP is certainly easier to use, and much faster to develop a site with. The language itself left a lot to be desired, and even with PHP 5.1, it still feels like some ex-Perl scripts hacked together templating HTML files. I guess the evil of &#8220;backward compatibility&#8221; has somehow hindered how the language can evolve. But that&#8217;s not the point &#8212; it is simple. It gets the job done.</p>
<p>People might think that scripting language without n-tier application server architecture is <em>not scalable</em> (can we say <a href="http://www.zdnet.com.au/news/software/0,2000061733,39193420,00.htm">IBM</a>? thou <a href="http://naeblis.cx/rtomayko/2005/05/28/ibm-poop-heads">some might beg to differ</a>). Even Andreessen himself would have his Java application server clusters behind the PHP web server layer.</p>
<p>But that&#8217;s not the point. Why would &#8220;scalability&#8221; be important anyway? At least not in this <del>Bubble 2.0</del> <a href="http://en.wikipedia.org/wiki/Web_2.0">Web 2.0</a> world. You just need to have some nifty idea, quickly build the app, make sure it is buzzword compliant, be the first on the market and hope the VC will knock on your door.</p>
<p>Still implementing your J2EE solution? You might finish when Burst 2.0 arrives. Give PHP, Python or the Rails a try instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2005/10/andreessen-java-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP XML-RPC Vulnerability</title>
		<link>http://scott.yang.id.au/2005/07/php-xml-rpc-vulnerability/</link>
		<comments>http://scott.yang.id.au/2005/07/php-xml-rpc-vulnerability/#comments</comments>
		<pubDate>Tue, 05 Jul 2005 13:34:51 +0000</pubDate>
		<dc:creator>scotty</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://scott.yang.id.au/2005/07/php-xml-rpc-vulnerability/</guid>
		<description><![CDATA[As discussed on Slashdot, is another PHP library vulnerability that affects PEAR&#8217;s XML-RPC module. James at GulfTech has demonstrated this vulnerability with an exploit. It turns out the PHP XML-RPC library uses eval() without checking, which allows arbitary PHP code to be executed if the XML-RPC message is cleverly crafted. The latest version of PHP [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://it.slashdot.org/article.pl?sid=05/07/04/2153224">As discussed on Slashdot</a>, is <a href="http://news.netcraft.com/archives/2005/07/04/php_blogging_apps_vulnerable_to_xmlrpc_exploits.html">another PHP library vulnerability</a> that affects PEAR&#8217;s <a href="http://www.xmlrpc.com/">XML-RPC</a> module. James at GulfTech has <a href="http://www.gulftech.org/?node=research&amp;article_id=00088-07022005">demonstrated this vulnerability with an exploit</a>. It turns out the <a href="http://phpxmlrpc.sourceforge.net/">PHP XML-RPC</a> library uses <code>eval()</code> without checking, which allows arbitary PHP code to be executed if the XML-RPC message is cleverly crafted.</p>
<p>The latest version of PHP XML-RPC is already available, and you can also use:</p>
<pre class="code">
# pear clear-cache
# pear upgrade XML_RPC
</pre>
<p>to update PEAR automatically. However, there are many hosts out, who do not follow security news closely, will not update the PEAR library for you. There are also versions of PHP XML-RPC libraries bundled with other existing applications that will not be updated, unless you also manually upgrade the whole package. As this vulnerability is serious &#8211; an attacker can insert arbitary PHP code which can easily lead to compromise of the whole system &#8211; I can smell the storm coming.</p>
<p>By the way, it has little to do with <a href="http://scott.yang.id.au/2005/06/wordpress-1513-released/">WordPress 1.5.1.3 security fix</a>. While both are related to XML-RPC calls, they are actually quite independent patches. WordPress&#8217; issue is to do with not escaping the incoming data properly, which might result SQL injection. While all security bugs are bad, I reckon a SQL injection is not as easy to exploit as PHP code injection. Still, please upgrade your WordPress version.</p>
<p>And WordPress team still have not fixed the backslash issue in XML-RPC calls. Eagerly waiting for 1.5.1.4&#8230;</p>
<p><b>Update</b>: Matt M <a href="http://photomatt.net/2005/07/05/xml-rpc-vulnerability/">addressed the potentially confused Slashdot crowd</a> that the recent WordPress patch has little to do with XML-RPC vulnerability previously discovered, probably <a href="http://comox.textdrive.com/pipermail/wp-hackers/2005-July/001770.html">taken from someone&#8217;s suggestion</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://scott.yang.id.au/2005/07/php-xml-rpc-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
