新版 PHP 預設啟用 APC 模組後造成 class 找不到的錯誤

假設環境:
PHP 5.3.20
Apache/2.2.23 (Unix)

aaa.php 檔案裡面有 AAA class,bbb.php 檔案裡面有 BBB class,bbb.php 中 include aaa.php。BBB class 的 b_func() 函式裡面用到 AAA class (即:$oA = new AAA())。

說明:
APC (Alternative PHP Cache) 是 PHP 的一個延伸模組套件,是 PHP 的另一種快取 (cache) 機制,可以直接拿既有的 OPCODE 執行、免去每次都直譯 php 程式產生 OPCODE 來跑,進而加快 php 程式的執行速度,號稱可以提昇 20% 到 30% 的速度。
筆者將手邊的 PHP 程式轉移到新版 PHP 環境下執行時,PHP 卻拋出「class 找不到」的錯誤訊息,類似以下 log 訊息:

[Tue Jan 29 04:04:46 2013] [error] [client 123.234.171.235] PHP Fatal error: Class ‘AAA’ not found in /sites/prj1/bbb.php on line 32

Continue reading “新版 PHP 預設啟用 APC 模組後造成 class 找不到的錯誤”

評估不同語系的相近內容頁面是否使用 canonical

說明:
網站的一些(產品)列表及各別(產品)細節頁面在不同語系頁面都會產生內容相近的頁面,這可能不利於 SEO,要評估一下是否在 <head> 區段中使用 canonical 來指定哪一個是 「標準網頁」。 Continue reading “評估不同語系的相近內容頁面是否使用 canonical”

Google AdSense 優化 (AdSense Optimization Tips)

前幾天聽 Google 線上課程「AdSense 優化工作坊」,剪貼其投影片重點如下:

一、提高點擊率 CTR
1. 位置: 第一屏很重要, 熱點位置
2. 尺寸/格式: 黃金尺寸 (IBA 尺寸為首選), 選擇放文字圖像廣告
3. 顏色: 融入頁面 (融合色, 互補色, 對比色)、持續測試
二、正向的影響 CPC,提高單價
1. 同時開啟文字&圖片廣告
2. 讓廣告主找到你
3. 不要過濾廣告主
4. 第一則廣告代碼 –> 高點擊率
三、提昇廣告展示流量PV
1. 增加每頁廣告數量
2. 用對產品
3. 多樣化收益: 行動上網趨勢
(原作者:Iris @ Google, Allan Ko @ Google)

邊聽邊整理到的重點:

Continue reading “Google AdSense 優化 (AdSense Optimization Tips)”

[架站] 為什麼網站的根目錄最好有 favicon.ico 和 robots.txt 存在?

o 如果已經在頁面的 <head> 中寫了 <link rel=”shortcut icon” href=”http://example.com/myicon.ico” /> 是否就不用在網站的根目錄中多弄一個 favicon.ico ?

o 如果所有頁面內容都不限制搜尋引擎的 bots 抓取,是否就不用在網站的根目錄中多弄一個 robots.txt ?

這一篇的結論是:還是讓它們存在網站的根目錄比較好。

Continue reading “[架站] 為什麼網站的根目錄最好有 favicon.ico 和 robots.txt 存在?”

[Apache][WP] 解決: wp-cron.php not found or unable to stat

[Apache][WP] 解決 error_log 中的 [error] [client 127.0.0.1] script ‘…/www/wp-cron.php’ not found or unable to stat 錯誤訊息

如果你一個 Apache web server 服務多個網站的話,而在 “主站” (寫在 …/apache/conf/httpd.conf 中的 DocumentRoot 那個即為主站) 的 error_log 檔案中要是看到上面這個訊息的話,那表示你在此 Apache 服務的網站中至少有一個網站是用 WordPress 架設的,並且它不是上述的 “主站”,而它嘗試要跑 wp-cron.php 時發生了錯誤。
Continue reading “[Apache][WP] 解決: wp-cron.php not found or unable to stat”

[Apache][MySQL] error_log: [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

在 apache web server 的 …/apache/logs/error_log 檔案如果很大,並且一直重複看到以下錯誤訊息:

[crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available
Continue reading “[Apache][MySQL] error_log: [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available”

Google 的 +1 指標 (plusone): 新增 +1 按鈕讓訪客在 Google 上推薦您的網站

[HTML][JS][WEB] Google 的 +1 指標 (plusone): 新增 +1 按鈕讓訪客在 Google 上推薦您的網站
Google Plus One (+1) Button, How to Add Google +1 Button to your Website

Facebook 有可以按「讚」的按鈕 (like button) 放在網頁上推薦該網頁 URL,而 Google 最近也推出了類似的功能:「+ 1 按鈕 (plusone)」,可以用來 “+1 您的網站/網頁”,意即按下 +1 按鈕,喜愛您內容的人就能在 Google 搜尋上或是您網站的頁面上進行推薦。但是要如何將「+ 1 」按鈕加進網頁中,讓您的網站或特定某個網頁 URL 脫穎而出呢?請看下文說明如何建立自訂 +1 按鈕。 Continue reading “Google 的 +1 指標 (plusone): 新增 +1 按鈕讓訪客在 Google 上推薦您的網站”