<?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>Juozas devBlog &#187; server</title>
	<atom:link href="http://dev.juokaz.com/tag/server/feed" rel="self" type="application/rss+xml" />
	<link>http://dev.juokaz.com</link>
	<description>Random ideas, scripts and facts</description>
	<lastBuildDate>Mon, 22 Mar 2010 10:48:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Don&#8217;t be afraid of PHP 5.3</title>
		<link>http://dev.juokaz.com/php/dont-be-afraid-of-php-5-3</link>
		<comments>http://dev.juokaz.com/php/dont-be-afraid-of-php-5-3#comments</comments>
		<pubDate>Tue, 02 Mar 2010 12:37:34 +0000</pubDate>
		<dc:creator>Juozas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[backwards compatibility]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[php 5.3]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://dev.juokaz.com/?p=977</guid>
		<description><![CDATA[While attending PHPUK conference in London, I noticed how much talk there is about PHP 5.3 and &#8220;when to upgrade?&#8221;, there was even a presentation about that. Because I have been using PHP 5.3 for more than half a year, I decided to share my views on this topic. This topic is very important as [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://dev.juokaz.com/wp-content/uploads/2009/05/osoft_1490922690php-logo-300x158.png" alt="" title="osoft_1490922690php-logo" width="150" height="79" class="alignnone size-medium wp-image-800" style="float: left; margin-right: 10px;" />While attending <a href="http://www.phpconference.co.uk/">PHPUK conference</a> in London, I noticed how much talk there is about PHP 5.3 and &#8220;when to upgrade?&#8221;, there was even a presentation about that. Because I have been using PHP 5.3 for more than half a year, I decided to share my views on this topic. This topic is very important as the earlier PHP 5.3 is adopted, the sooner second iteration of frameworks can be released (story for <a href="http://www.symfony-project.org/blog/2009/10/27/why-will-symfony-2-0-finally-use-php-5-3">Symfony</a>).</p>
<h5>New features</h5>
<p>PHP 5.3 includes a lot of <a href="http://php.net/releases/5_3_0.php">new features</a>. Some of them are new language features like namespaces, closures, exceptions chaining, jump labels etc., and even though these are very recommended to learn, they are not required. You can continue to write code as you are used to and chances are that it will still work (more about that in <em>Legacy code</em>). </p>
<p>What is important from new features is fixes are enhancements. For example new garbage collector and other fixes reduce memory usage and increases performance. There are also some new extensions like <a href="http://php.net/phar">phar</a>, <a href="http://php.net/sqlite3">sqlite3</a> and <a href="http://php.net/fileinfo">fileinfo</a> and some libraries (like mysql or openssl) have some major improvements. Finally, Windows support is improved even further and now is expected to be even more production-ready.</p>
<h5>Legacy code</h5>
<p>Apparently the biggest problem is with legacy applications &#8211; somehow everyone just decided that because of all these new features, everything should break. If you&#8217;d look at backward incompatibility list <a href="http://php.net/manual/en/migration53.incompatible.php">here</a>, you notice that not that much has changed. Or in other words &#8211; if your code was <em>&#8220;correct&#8221;</em> before upgrade, it will work fine with PHP 5.3 too. For example static and/or private setters, ereg and some more other features shouldn&#8217;t have been used in a first place as manual clearly stated that.</p>
<p>Personally I have upgraded around 10 projects to run on PHP 5.3, each took less than an hour. On my development machine I also have <a href="http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting">strict</a> error reporting level so I even had to remove marked-as-deprecated code, but for larger part of code everything worked fine. Furthermore, some of that code has been written using PHP 4, a couple years ago, and it still worked just fine. </p>
<h5>Debian&#8230;</h5>
<p>As far as I&#8217;m aware of, main linux distros like Debian or Red Hat do not have PHP 5.3 in their <em>stable</em> repositories, which makes upgrading potentially very hard or impossible. I have come across this before &#8211; sysadmins do not want to install anything outside from stable, so the only option is to wait (that happened to me when PHP 5 was still not well adopted). This is probably the only reasonable argument to not switch to PHP 5.3, but only if you don&#8217;t have option to switch servers.</p>
<p>I&#8217;m lucky with this problem, because I do not administer servers, but still can request for any PHP version I want. If you do not have this option, maybe it&#8217;s time to switch hosting server provider? There can be different situations, but software version shouldn&#8217;t be a limiting factor, especially when new version is available and known to be stable enough. You can even use <a href="http://www.top-web-solutions.com/apache-with-multiple-php-versions.html">multiple PHP versions</a> if switching server would require testing a lot of applications.</p>
<h5>Why you should be using PHP 5.3 right now</h5>
<p>Firstly because it has those new features, which mean that you can start to use them as an early adopter and benefit later. All <em>second iteration</em> frameworks (Zend Framework 2.0, <a href="http://symfony-reloaded.org/">Symfony 2.0</a>, Lithium etc.) coming out late this year will use PHP 5.3 extensively, so knowing how namespaces work (I&#8217;d say they are the ones you need to look first) and how to utilize closures will mean that you can get going very quickly. </p>
<p><a href="http://www.doctrine-project.org/documentation/2_0/en">Doctrine 2.0</a> is probably the best example of why you should learn PHP 5.3 now &#8211; most of its features could be written in older versions too, but not as clean and easy to understand. And it&#8217;s already in <em>alpha</em> stage, so stable version might be coming out very soon and yet again &#8211; if you want to stay on top of your game, you need to know how it works and how to leverage all new features. </p>
<p>As mentioned above, because of new garbage collector implementation PHP 5.3 performs much better (<a href="http://schlueters.de/blog/archives/68-PHP-5.3-Up-to-30-performance-win.html">benchmarks</a>). From my personal tests I have noticed that Zend Framework uses much less memory, just because there is less <a href="http://en.wikipedia.org/wiki/Memory_leak">memory leaks</a>, Doctrine of course gets a big <a href="http://dev.juokaz.com/php/zend-framework-and-doctrine-part-3">speed up</a> too.</p>
<h5>Conclusion</h5>
<p>I&#8217;m yet unsure what is all that buzz about &#8211; PHP 5.3 is stable, way faster than previous versions and works with legacy code just fine. Considering that it has new core features, which will be expected from developers to be known in just a few months, I don&#8217;t see a reason why you shouldn&#8217;t use it. And if you have any questions you can just ask me directly on <a href="http://twitter.com/juokaz">twitter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.juokaz.com/php/dont-be-afraid-of-php-5-3/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Zend Optimizer and PHP comments</title>
		<link>http://dev.juokaz.com/php/zend-optimizer-and-php-comments</link>
		<comments>http://dev.juokaz.com/php/zend-optimizer-and-php-comments#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:50:17 +0000</pubDate>
		<dc:creator>Juozas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[optimizer]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[xmlrpc]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://dev.juokaz.com/?p=3</guid>
		<description><![CDATA[Zend Optimizer is nice product, but I can&#8217;t make it work with PHP&#8217;s Reflection. Reflection is very good functionality which allows script to read and extract information from it-self&#8217;s source code. For example, Zend_XmlRpc_Server component checks functions signatures (which are phpdoc comments) to determine if given parameter(s) is valid type, etc.
I have been using Zend [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zend.com/en/products/guard/optimizer/">Zend Optimizer</a> is nice product, but I can&#8217;t make it work with PHP&#8217;s <a href="http://uk3.php.net/oop5.reflection">Reflection</a>. Reflection is very good functionality which allows script to read and extract information from it-self&#8217;s source code. For example, <a href="http://framework.zend.com/manual/en/zend.xmlrpc.server.html">Zend_XmlRpc_Server</a> component checks functions signatures (which are <a href="http://en.wikipedia.org/wiki/PHPDoc">phpdoc</a> comments) to determine if given parameter(s) is valid type, etc.</p>
<p>I have been using Zend Framework for some time now, and found that only possible way to use XmlRpc Server package is to delete all functions signatures checking. My production server has Zend Optimizer installed and it just breaks Reflection functionality.</p>
<p>For tests I created simple reflection example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 *  My Class
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> test <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$oClassReflect</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ReflectionClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$oClassReflect</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDocComment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>First time script outputs:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/**
 *  My Class
 */</pre></div></div>

<p>Next times there is <strong>no output</strong> at all &#8211; all comments are gone (in Optimizer&#8217;s cache). I still can get methods of class (source code is not gone), but I cannot use comments to mark params/return types and later use them to validate I/O.</p>
<p>I don&#8217;t know yet if it&#8217;s a problem with my production server, but Zend manuals are not very clear and I can&#8217;t find any information about comments stripping issue. Has anyone had similar problems?</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.juokaz.com/php/zend-optimizer-and-php-comments/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
