<?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>CodePy.Net &#187; php5.3</title>
	<atom:link href="http://codepy.net/tag/php5-3/feed" rel="self" type="application/rss+xml" />
	<link>http://codepy.net</link>
	<description>专注网络开发：Python,PHP,Vim,Linux 分享我的快乐 -- Share My Happiness</description>
	<lastBuildDate>Sun, 15 Jan 2012 16:20:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP5.3 和CakePHP1.2的兼容性问题</title>
		<link>http://codepy.net/2009/09/30/cakephp-with-php5-3.html</link>
		<comments>http://codepy.net/2009/09/30/cakephp-with-php5-3.html#comments</comments>
		<pubDate>Wed, 30 Sep 2009 12:45:22 +0000</pubDate>
		<dc:creator>ruitao</dc:creator>
				<category><![CDATA[编程语言]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php5.3]]></category>

		<guid isPermaLink="false">http://codepy.net/?p=160</guid>
		<description><![CDATA[最近一次升级Archlinux，PHP升级到了5.3，遇到了两个问题： 1.Arch里面PHP更换了打包的方式，PHP的Aapche模块被独立封装为php-apache模块，所以安装了php包之后还要安装 php-apache包（如果你用Apache作为你的Web server ^^ ）。 2.另外就是Cakephp1.2跟PHP5.3的兼容性问题了。安装PHP5.3之后，运行Cakephp应用遇到了错误： 一个是提示strtotime()出错，最终修改php.ini的 date.timezone 解决，改为： date.timezone = Asia/Chongqing 时区的列表可以到这里查看：http://us.php.net/manual/pt_BR/timezones.php 另外就是报类似以下的错误： Deprecated: Assigning the return value of new by reference is deprecated… 这个有两种解决方法，一是将Cakephp升级到最新的Cakephp1.3dev版本，但是现在1.3版本并不是稳定版本，如果想继续使用1.2 版本的话，需要: 1.修改cake运行库下面cake/console/cake.php文件。 将141行的 141 142 143 144 145 function __initConstants&#40;&#41; &#123; if &#40;function_exists&#40;'ini_set'&#41;&#41; &#123; ini_set&#40;'display_errors', '1'&#41;; ini_set&#40;'error_reporting', E_ALL&#41;; ... 改为： 141 142 143 144 145 146 147 148 [...]]]></description>
			<content:encoded><![CDATA[<p>最近一次升级Archlinux，PHP升级到了5.3，遇到了两个问题：</p>
<p>1.Arch里面PHP更换了打包的方式，PHP的Aapche模块被独立封装为php-apache模块，所以安装了php包之后还要安装 php-apache包（如果你用Apache作为你的Web server ^^ ）。</p>
<p>2.另外就是Cakephp1.2跟PHP5.3的兼容性问题了。安装PHP5.3之后，运行Cakephp应用遇到了错误：</p>
<p>一个是提示strtotime()出错，最终修改php.ini的 <strong>date.timezone </strong>解决，改为：<strong> </strong></p>
<pre>date.timezone = Asia/Chongqing</pre>
<p>时区的列表可以到这里查看：<a href="http://us.php.net/manual/pt_BR/timezones.php" target="_blank">http://us.php.net/manual/pt_BR/timezones.php</a></p>
<p>另外就是报类似以下的错误：</p>
<p>Deprecated: Assigning the return value of  new by reference is deprecated…</p>
<p>这个有两种解决方法，一是将Cakephp升级到最新的Cakephp1.3dev版本，但是现在1.3版本并不是稳定版本，如果想继续使用1.2 版本的话，需要:</p>
<p>1.修改cake运行库下面cake/console/cake.php文件。</p>
<p>将141行的</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>141
142
143
144
145
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> __initConstants<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ini_set'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error_reporting'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">...</span></pre></td></tr></table></div>

<p>改为：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>141
142
143
144
145
146
147
148
149
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> __initConstants<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ini_set'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'E_DEPRECATED'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error_reporting'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ALL</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> ~E_DEPRECATED<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error_reporting'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">...</span></pre></td></tr></table></div>

<p>2.修改cake/libs/configure.php<br />
将292行的</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>292
293
294
295
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'debug'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>debug<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">error_reporting</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">......</span></pre></td></tr></table></div>

<p>修改为：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>292
293
294
295
296
297
298
299
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'debug'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>debug<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'E_DEPRECATED'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error_reporting'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ALL</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> ~E_DEPRECATED<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error_reporting'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_ALL</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">......</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://codepy.net/2009/09/30/cakephp-with-php5-3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

