<?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>Eric&#039;s Who Know &#187; php.ini</title> <atom:link href="http://who-know.com/tag/php-ini/feed/" rel="self" type="application/rss+xml" /><link>http://who-know.com</link> <description>C&#039;est La Vie</description> <lastBuildDate>Mon, 17 May 2010 22:21:05 +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>Fatal error: Maximum execution time of 30 seconds exceeded</title><link>http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/</link> <comments>http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/#comments</comments> <pubDate>Thu, 18 Feb 2010 22:35:55 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[.htaccess]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[php.ini]]></category> <category><![CDATA[SuPHP]]></category> <category><![CDATA[wp-config]]></category><guid isPermaLink="false">http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/</guid> <description><![CDATA[WordPress 出現 Fatal error: Maximum execution time of 30 seconds exceeded 是因為主機對程式的執行時間作了限制，解決方法如下 :
// 擇一使用即可，依不可行性排序
01. 自己的主機 or 虛擬主機且可以修改 php.ini
a. 修改 php.ini 裡 max_execution_time 的數值，重新啟動 Server
b. .htaccess 加上 php_value max_input_time 300
c. wp-config.php 加上 set_time_limit( 300 );
02. 虛擬主機 : 不可以修改 php.ini
a. .htaccess 加上 php_value max_execution_time 300
b. wp-config.php 加上 set_time_limit( 300 );
// 如果主機有安裝 suPHP
.htaccess  file 的 php_value [...]]]></description> <content:encoded><![CDATA[<p><a href="http://wordpress.org/" target="_blank">WordPress</a> 出現 Fatal error: Maximum execution time of 30 seconds exceeded 是因為主機對程式的執行時間作了限制，解決方法如下 :</p><p>// 擇一使用即可，依不可行性排序</p><p>01. 自己的主機 or 虛擬主機且可以修改 php.ini</p><p>a. 修改 php.ini 裡 max_execution_time 的數值，重新啟動 Server<br /> b. .htaccess 加上 php_value max_input_time 300<br /> c. wp-config.php 加上 set_time_limit( 300 );</p><p>02. 虛擬主機 : 不可以修改 php.ini</p><p>a. .htaccess 加上 php_value max_execution_time 300<br /> b. wp-config.php 加上 set_time_limit( 300 );</p><p>// 如果主機有安裝 <a href="http://www.suphp.org/" target="_blank">suPHP</a><br /> <span style="color: #ff0080">.htaccess  file 的 php_value max_execution_time 300 改成 max_execution_time = 300</span></p><p>Ref :<br /> 01. <a href="http://www.php.net/manual/en/info.configuration.php" target="_blank">PHP Runtime Configuration</a><br /> 02. <a href="http://php.net/manual/en/function.set-time-limit.php" target="_blank">PHP set_time_limit ( int $seconds )</a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/fatal-error-maximum-execution-time-of-30-seconds-exceeded/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>WordPress Warning: Cannot modify header information &#8211; headers already sent by</title><link>http://who-know.com/wordpress-warning-cannot-modify-header-information-headers-already-sent-by/</link> <comments>http://who-know.com/wordpress-warning-cannot-modify-header-information-headers-already-sent-by/#comments</comments> <pubDate>Fri, 09 Oct 2009 08:41:45 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[.htaccess]]></category> <category><![CDATA[php.ini]]></category> <category><![CDATA[SuPHP]]></category> <category><![CDATA[UTF-8]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[wp-config]]></category><guid isPermaLink="false">http://who-know.com/?p=88</guid> <description><![CDATA[01. 如果要存檔成 UTF-8, 千萬別跟自己過不去, 去使用 Windows 內建的記事本, 請使用 PSPad, NotePad++, EmEditor, UltraEdit 或其它好一點的文字編輯器。因為使用 Windows 內建的記事本, 以UTF-8存檔時, 會自動添加 BOM 標籤, 而造成一些問題, 如 Warning: Cannot modify header information - headers already sent by...。02. 以下由易達成性來做排序
&#160;&#160;a. 使用 PSPad, NotePad++, EmEditor, UltraEdit 或其它的好一點的文字編輯器, 來另存成 UTF-8 且選擇不要添加 BOM 標籤。
&#160;&#160;&#160;&#160;PSPad : 格式 -> UTF-8 -> 存檔
&#160;&#160;&#160;&#160;UltraEdit : 檔案 -> 另存新檔 -> 格式選 [...]]]></description> <content:encoded><![CDATA[<p>01. 如果要存檔成 UTF-8, 千萬別跟自己過不去, 去使用 <a href="http://www.microsoft.com/" target="_blank">Windows</a> 內建的記事本, 請使用 <a href="http://www.pspad.com/" target="_blank">PSPad</a>, <a href="http://notepad-plus.sourceforge.net/" target="_blank">NotePad++</a>, <a href="http://www.emeditor.com/" target="_blank">EmEditor</a>, <a href="http://www.ultraedit.com/" target="_blank">UltraEdit</a> 或其它好一點的文字編輯器。因為使用 <a href="http://www.microsoft.com/" target="_blank">Windows</a> 內建的記事本, 以UTF-8存檔時, 會自動添加 BOM 標籤, 而造成一些問題, 如 Warning: Cannot modify header information - headers already sent by...。</p><p><a href="http://pic.who-know.com/Single/PSPad_UTF-8_BOM_Label.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Single/PSPad_UTF-8_BOM_Label.png" alt="" width="500" height="120" /></a></p><p><span id="more-88"></span><br /> 02. 以下由易達成性來做排序</p><p>&nbsp;&nbsp;a. 使用 <a href="http://www.pspad.com/" target="_blank">PSPad</a>, <a href="http://notepad-plus.sourceforge.net/" target="_blank">NotePad++</a>, <a href="http://www.emeditor.com/" target="_blank">EmEditor</a>, <a href="http://www.ultraedit.com/" target="_blank">UltraEdit</a> 或其它的好一點的文字編輯器, 來另存成 UTF-8 且選擇不要添加 BOM 標籤。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.pspad.com/" target="_blank">PSPad</a> : 格式 -> UTF-8 -> 存檔<br /> &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.ultraedit.com/" target="_blank">UltraEdit</a> : 檔案 -> 另存新檔 -> 格式選 UTF-8 無 BOM<br /> &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://notepad-plus.sourceforge.net/" target="_blank">NotePad++</a> : 格式 -> 編譯成 UTF-8碼 (檔首無 BOM) -> 存檔<br /> &nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.emeditor.com/" target="_blank">EmEditor</a> : 檔案 -> 另存新檔 -> 編碼選 UTF-8, 下方的加入一個 Unicode 籤名 (BOM) 不要打勾</p><p>&nbsp;&nbsp;b. 檢查 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a> 的 &lt;?php 前, 和 ?&gt; 後是否有多於的空白或空行。</p><p>&nbsp;&nbsp;c. 使用 <a href="http://www.microsoft.com/" target="_blank">Windows</a> 內建的記事本打開 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a>, 然後直接另存新檔, 編碼請選擇 ANSI。</p><p>&nbsp;&nbsp;d. 到 <a href="http://wordpress.org/latest.zip" target="_blank">WordPress.zip</a> 或 <a href="http://wordpress.org/latest.tar.gz" target="_blank">WordPress.tar.gz</a> 下載最新版本的 <a href="http://wordpress.org/" target="_blank">WordPress</a>, 解壓出 wp-config-sample.php, 改檔名成 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a>, 再依您實際狀況, 來修改 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a> 裡面的設定。</p><p>&nbsp;&nbsp;e. 於 php.ini 添加或修改</p><pre class="brush: php;">output_buffering = On</pre><p>或</p><pre class="brush: php;">output_buffering = 4096</pre><p>// 如果您使用的是虛擬主機, 且可以修改 php.ini, 那就在 php.ini 添加上面兩句其中一句; 如果主機是自己的, 那就打開 php.ini, 把 output_buffering 設定成 On 或 4096。</p><blockquote><p> ; Output buffering allows you to send header lines (including cookies) even<br /> ; after you send body content, at the price of slowing PHP's output layer a<br /> ; bit.  You can enable output buffering during runtime by calling the output<br /> ; buffering functions.  You can also enable output buffering for all files by<br /> ; setting this directive to On.  If you wish to limit the size of the buffer<br /> ; to a certain size - you can use a maximum number of bytes instead of 'On', as<br /> ; a value for this directive (e.g., output_buffering=4096).<br /> output_buffering = Off</p></blockquote><p>03. 為什麼這個問題大部分發生在大陸用戶呢? 分別看了 <a href="http://cn.wordpress.org/" target="_blank">CN</a> 和 <a href="http://wptw.org/" target="_blank">TW</a>, 就不難發現</p><p>a. <a href="http://cn.wordpress.org/" target="_blank">CN</a> 的做法是: WordPress en + zh_CN.mo, zh_CN.po, 翻譯過的 wp-config-sample.php, readme.html, setup-config.php 的整合包<br /> b. <a href="http://wptw.org/" target="_blank">TW</a> 的做法是: WordPress en + zh_TW.mo, zh_TW.po 語言包</p><p>如果您用好一點的文字編輯器, 或者是讓安裝程式自動由 wp-config-sample.php 產生 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a>, 那您可能不會遇到這個問題, 還會感覺 <a href="http://cn.wordpress.org/" target="_blank">CN</a> 真貼心, 連安裝過程都翻譯成您熟悉的語言了。</p><p>04. 如果您 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a> 都打開了, 那不妨順便添加下面 2 句</p><pre class="brush: php;">
define('WP_POST_REVISIONS', false);
define('AUTOSAVE_INTERVAL', 86400);
</pre><p>&nbsp;&nbsp;a. AUTOSAVE_INTERVAL : 用來設定自動儲存的時間間隔, 單位為 sec 秒。</p><p>&nbsp;&nbsp;b. <a href="http://codex.wordpress.org/Revision_Management" target="_blank">WP_POST_REVISIONS</a> 用來設定文章版本數 : false 那邊可以改成 -1 (同 true), 0 (同 false), >1 的整數, 如果您希望每個修改的版本都儲存下來; 那就設定成 -1 (同 true), 如果您希望關閉文章版的的功能, 那就設定成 0 (同 false); 如果您希望只要保存一固定數量, 就設定成 >1 的整數。</p><blockquote><p> true (default), -1: store every revision<br /> false, 0: do not store any revisions (except the one autosave per post)<br /> (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.</p></blockquote><p>如果之前的文章版本已經積的很多了, 可以利用 <a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a> 來刪除, 不過記得先備份資料庫喔。<br /> // 也可以用 <a href="http://www.phpmyadmin.net/" target="_blank">Delete-Revision</a> 這個插件來做刪除。</p><pre class="brush: php;">DELETE FROM wp_posts WHERE post_type = &quot;revision&quot;;</pre><p>// 沒有說一定要用 <a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a> 才能刪除, 而是一般虛擬主機大多提供的是 <a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a> 所以 ..., 如果要用 MySQL command-line 或其它的工具也是可以的喔。</p><p>&nbsp;&nbsp;c. 另外, 如果出現 Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate xxx bytes) in ... 則可以加上下面那句, 如果 64M 還是不夠就把數字再改大一點。但是如果您的主機商有限制 Memory limit 上限, 那就只能停用一些較沒再使用的外掛。</p><pre class="brush: php;">define('WP_MEMORY_LIMIT', '64M');</pre><p>// 有些人會去改 ./wp-settings.php, 但每升級一次就要改一次, 所以改 <a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">wp-config.php</a> 會比較好。</p><pre class="brush: php;">if ( !defined('WP_MEMORY_LIMIT') )
  define('WP_MEMORY_LIMIT', '32M');</pre><p>// 另外, 修改 php.ini 也是一個辦法</p><pre class="brush: php;">memory_limit = 16M</pre><p>// 最後, 修改 .htaccess file 也可行, 加上</p><pre class="brush: php;">php_value memory_limit 96M</pre><p>// 如果您的虛擬主機有安裝 <a href="http://who-know.com/enable-gzip-compression-with-suphp-installed/" target="_blank">SuPHP</a>, 則 .htaccess file 請改成</p><pre class="brush: php;">memory_limit = 96M</pre><p>Ref:<br /> 01. <a href="http://www.unicode.org/faq/utf_bom.html" target="_blank">UTF-8, UTF-16, UTF-32 &#038; BOM</a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/wordpress-warning-cannot-modify-header-information-headers-already-sent-by/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>解決 PHP 5.3.0 + WordPress 造成 It is not safe to rely on the system’s timezone settings.</title><link>http://who-know.com/php-wordpress-it-is-not-safe-to-rely-on-the-system-timezone-settings/</link> <comments>http://who-know.com/php-wordpress-it-is-not-safe-to-rely-on-the-system-timezone-settings/#comments</comments> <pubDate>Sat, 03 Oct 2009 18:16:36 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[APMServ]]></category> <category><![CDATA[Appserv]]></category> <category><![CDATA[date_default_timezone_set]]></category> <category><![CDATA[EasyPHP]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[php.ini]]></category> <category><![CDATA[PHPnow]]></category> <category><![CDATA[timezone]]></category> <category><![CDATA[WampServer]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[XAMPP]]></category><guid isPermaLink="false">http://who-know.com/?p=83</guid> <description><![CDATA[Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead in [...]]]></description> <content:encoded><![CDATA[<p>Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead in /Path_to_your/www/wp-includes/functions.php on line 35</p><p>Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead in /Path_to_your/www/wp-includes/functions.php on line 43</p><p>Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead in /Path_to_your/www/wp-includes/functions.php on line 35</p><p>Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead in /Path_to_your/www/wp-includes/functions.php on line 43</p><p><span id="more-83"></span>00. 大多看到這問題發生在您用的是 <a href="http://www.php.net/" target="_blank">PHP</a> 5.3.0 或使用套裝軟體搭配的 <a href="http://www.php.net/" target="_blank">PHP</a> 版本是 5.3.0。</p><p>01. 下面為解決的方法, 則一使用即可, 依推薦使用的順序排序。</p><p>&nbsp;&nbsp;1. 修改 ./wp-config.php, 加上</p><pre class="brush: php;">date_default_timezone_set('Asia/Taipei');</pre><p>&nbsp;&nbsp;2. 修改 ./wp-includes/functions.php</p><p>&nbsp;&nbsp;&nbsp;&nbsp;a. 在第一個 function 前面加上<pre class="brush: php;">date_default_timezone_set('UTC+8');</pre><p>&nbsp;&nbsp;&nbsp;&nbsp;b. 在第一個 function 前面加上<pre class="brush: php;">date_default_timezone_set('Asia/Taipei');</pre><p>&nbsp;&nbsp;3. 修改 php.ini, 加上</p><pre class="brush: php;">date.timezone = &quot;Asia/Taipei&quot;</pre><p>02. 上面的 Asia/Taipei 均可以替換成下面任一城市, 其它城市請到 <a href="http://www.appservnetwork.com/" target="_blank">PHP timezones</a> 尋找</p><p>日本 : Asia/Tokyo<br /> 台北 : Asia/Taipei<br /> 重慶 : Asia/Chongqing<br /> 漢城 : Asia/Seoul<br /> 上海 : Asia/Shanghai<br /> 新加坡 : Asia/Singapore<br /> 澳門 : Asia/Macao 或 Asia/Macau<br /> 香港 : Asia/Hong_Kong 或 Asia/Chungking</p><p>03. 上面所提到的套裝軟體為 <a href="http://www.appservnetwork.com/" target="_blank">AppServ</a>, <a href="http://phpnow.org/" target="_blank">PHPnow</a>, <a href="http://www.apachefriends.org/" target="_blank">XAMPP</a>, <a href="http://www.wampserver.com/" target="_blank">WampServer</a>, <a href="http://www.wampserver.com/" target="_blank">APMServ</a>, <a href="http://www.easyphp.org/index.php" target="_blank">EasyPHP</a>。</p><p>Ref:<br /> 01. <a href="http://wordpress.org/support/topic/285337" target="_blank">WordPress Support</a><br /> 02. <a href="http://us3.php.net/manual/en/function.date-default-timezone-set.php" target="_blank">PHP date_default_timezone_set</a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/php-wordpress-it-is-not-safe-to-rely-on-the-system-timezone-settings/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> </channel> </rss>