Posts

Showing posts from 2010

Fatal error: Call to undefined function invite_page_title() in /xxx/includes/menu.inc on line 504

最近把一個 Drupal 網站換到另外一個空間 登入網站後就發生了上面的錯誤訊息 原本以為是 invite 模組 在 menu 裡面沒有移除乾淨 但到 menu 的 table 裡面卻又沒看到 invite 字眼的資料 查了一下才發現這是 cache 的問題 登入後雖然會出現 error msg 但你還是可以到 /admin/settings/performance 去把 cache 給清掉 程式就會正常了 參考資料: Fatal Error | drupal.org

安裝 memcached

如何在 CentOS 5.5 Zend Server 5.0.3 下安裝 memcached 由於 Zend Server 也是用 apache 所以設定上大致相同 php pecl 同時有 memcache 跟 memcache d 兩個套件 建議安裝 memcache d 這個後續還有在維護的套件 1. 安裝所需套件 libevent-devel yum install libevent-devel 2. 下載 libmemcached http://download.tangent.org/libmemcached-0.44.tar.gz ./configure make && make install 3. 啟動 memcached /usr/local/bin/memcached -d -u root -m 512 -p 11211 4. 安裝 pecl memcached /usr/local/zend/bin/pecl install memcached 然後在 php.ini 加入設定 extension = memcached.so ;extension = /usr/local/zend/lib/php_extensions/memcached.so(請不要設定直接路徑,會抓不到,請以上面設定為主) 5. 重開後看看 phpinfo 裡面是否有 memcached

如何申請 Windows Live ID 的 Apps

用 Drupal 以來一直有個問題 第三方開發者開發的程式說明不足夠 對於這種菜鳥總是要花很多時間去找到底是哪邊出了問題 甚至還有模組把 function 寫好 功能頁面還要你自己去寫 orz... 這次是因為裝了 Windows Live ID Integration 到了 My Account 裡面有個 Windows Live Indentity, 點 Activate Windows Live ID 進去認證會導到 http://localhost/webauth/sample/webauth-handler.php 發現無法正常使用 或者是我沒發現開發者把申請 App ID 的資訊寫到哪邊 後來在網路上找到一篇 msdn 的文章 終於解開了我的迷惑~ 最主要要去下面申請 App,這邊需要 Windows Live ID 當作申請的帳號 Live Services Developer Portal 他會給你 Application ID、Domain(s)、Return URL、Secret Key 這幾個資訊 其中 Domain 跟 Ruturn URL 是你自己設定的,Ruturn URL 要設定 callback 的網址,通常跟 Domain 位置會不一樣,但如果你用 Drupal 應該是一樣的,但 Return URL 前面要加上 http:// ,並且後面要加上 winliveid/handler,如 http://example.com/winliveid/handler 然後把 Application ID 跟 Secret Key 拿去餵 Windows Live ID Integration 的 Application-Key.xml 就好了 使用 Windows Live ID Integration 的版本為 6.x-1.x-dev(2010-Jul-11) 參考資訊: Running the PHP QuickStart Sample

使用手機發 Facebook stream.publish

一般 Facebook 的 access token 取得方式僅能夠用在註冊的網站 如果你用在手機的話,他會噴下面訊息給你看 Invalid access token signature. 而且用手機發還需要有 uid 或 session key 這兩個其中一個參數 不然他會噴 parameters uid or session key required 整個傳送方式如下: step 1. 取得 code https://graph.facebook.com/oauth/authorize?client_id=175981222462&redirect_uri=http://otc.mymode.idv.tw&display=touch&scope=user_photos,email,user_birthday,user_online_presence,offline_access,publish_stream (2010-10-06 更新) step 2. 取得 token https://graph.facebook.com/oauth/access_token?client_id=your client id&redirect_uri=your uri&client_secret=your client secret&code=上面的 code= &type=client_cred step 3. 發送 stream.publish https://api.facebook.com/method/stream.publish?format=json&message=your message &uid=your uid &access_token=your token 參考網站: Error validating verification code.

Drupal : Fatal error: Call to undefined function oauth_common_authorization_levels() in...

這次輪到 Services OAuth 了! 錯誤訊息: Fatal error : Call to undefined function oauth_common_authorization_levels() in xxx \sites\default\modules\services_oauth\services_oauth.admin.inc on line 19 請先確認一下您裝得版本是否正確 NOTICE: The 6.x-2.x branch of services_oauth is not compatible with the 6.x-2.x branch of services. To use the 6.x-2.x branch you must use the 6.x-3.x branch of services. 如果您剛好 Services 是裝 6.x-2.2 版 而 Service OAuth 就只能裝 6.x-1.0-beta6 版 你應該在 admin/build/services/authentication 會遇到上面的錯誤畫面 請修改這兩支檔案 1. services_oauth.admin.inc 第 19 行請改成 foreach (oauth_common_context_load_all() as $name => $level) { 2. services_oauth.inc 第 79 行請改成 $autho_levels = oauth_common_context_load_all(); 這樣就功德圓滿了~

Druapl : user warning: Table 'drupal.services_keys' doesn't exist query: SELECT * FROM services_keys in...

如果您的 drupal 上面裝了很多 services server 那就有可能遇到這個問題 user warning: Table 'drupal.services_keys' doesn't exist query: SELECT * FROM services_keys in" 可以先把 services server 跟相關的 services 關掉 最後再把 services 給移除後重新安裝 然後 enable 後再把原本的 services 打開 應該就不會以上的錯誤訊息了 以下的 reference 還有人出 $50 解決這個問題咧 XD Reference: Will Pay $50 to have someone manually install database tables

Drupal 的粗體驗

最近在玩 Druapl 不過好像是被 Druapl 玩 裝了一堆有關 SNS 的 third-party 的程式 發現都動不太了 測試後去看程式才發現這程式有點小 bug orz... 目前遇到兩個解決方式如下: json server druapl 的 web service 很有趣,所有的 services (json、soap、rest、xml-rpc、amf等)都是 based on services 這個模組 問題發生版本: 6.x-2.0-alpha2 錯誤訊息: { "#error": true, "#data": "Invalid method " } 解決方式: 請將 json_server.module 中第 40 行 $request = drupal_parse_json($_POST['method']); 更改為 $request = $_POST['method']; soap server 問題發生版本: 6.x-1.2-beta1 錯誤訊息: You must specify a name when you register an operation 解決方式: 將 soap_server.module 中的變數中前的 # 移除 可參考這支檔案修改 例如 foreach ($method['#args'] as $arg) { 改成 foreach ($method['args'] as $arg) { 上面那個檔案中所有的都要改掉喔! Reference: Example: Accessing JSON server via cURL More: You must specify a name when you register an operation

DSN : invalid attribute string

MySQL ODBC 一路用起來都沒發現過什麼問題 但昨天想說把 server 上的 myodbc 升級到 5.1.7 的版本 就是得猴的開始了… 原本版本是 3.51 都好好得 但原本用的 G6 FTP 昨天發現在得猴 剛開完機都還可以連 但過一下他就給我葛屁了 由於是設定 dsn 連線 追回去 dsn 那邊就掛了 會出現 invalid attribute string 的字樣 反覆移除了好幾次的 myodbc 後來終於試出來了… 可能是使用 windows server 2003 比較舊的作業系統的關係 把他還原成 3.51.12 就正常了(移掉鬼 5.1.7 版)

安裝 AIR @ CentOS

在 CentOS 上安裝 AIR runtime 發生了以下的錯誤訊息 [root@dev www]# rpm -ivh adobeair.i386.rpm warning: adobeair.i386.rpm: Header V3 DSA signature: NOKEY, key ID f6777c67 error: Failed dependencies: /usr/lib/libxslt.so.1 is needed by adobeair-2.0.3-13070.i386 安裝 libxslt 就好了 yum install libxslt-devel

升級 drupal core

Drupal 升級步驟 1. 備份網站及資料庫 2. 先用 uid = 1 的帳號登入,把網站 off-line 3. 下載新版的 drupal 下來解壓縮 4. 把舊版網站 rename,新版網站改成舊版網站 5. 把舊版網站模組資料夾及設定檔複製到新站去(sites/default/settings.php, sites/default/files, sites/all/modules) 6. 把 settings.php 中的 $update_free_access 改成 true 7. 開始執行 update.php, step by step 8. 升級完成後記得把 settings.php $update_free_access 改成 false, 網站要記得 on-line 8. 完成 drupal core 升級

Memcached 啟動失敗

/usr/local/bin/memcached -d -u nobody -m 512 -p 11211 127.0.0.1 執行上面指令要啟動 memcached 時,出現了以下錯誤 /usr/local/bin/memcached: error while loading shared libraries: libevent-1.1a.so.1: cannot open shared object file: No such file or directory 查了一下現在系統中的 libevent 是 1.4 的版本 跟錯誤訊息中 1.1 差距有點大 最近有執行 yum update 沒去注意到更新了哪些程式 猜想應該是更新後才造成路徑的問題 所幸就重裝 memcached 吧! 先把原本的移除 cd /usr/local/src/memcached-1.4.5 make install clean 然後再安裝 ./configure make; make install 然後就可以正常啟動囉~ 參考資料: Install memcached on CentOS 5

PHP4 上安裝 freetds

Image
FreeTDS 是用來在 Unix-like 下連結 SQL SERVER 用的 先安裝 unixODBC-devel 套件 # yum install unixODBC-devel 再來編譯 FreeTDS # ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --with-unixodbc=/usr touch 這兩個檔案讓 php compile 過 # touch /usr/local/freetds/include/tds.h # touch /usr/local/freetds/lib/libtds.a 加入以下參數重新編譯 --with-unixODBC \ --with-mssql=/usr/local/freetds \ 編譯完重新啟動 apache 即可 可檢查 phpinfo() 中是否有 mssql 支援 為什麼要 tocuh 咧 可參考這邊 http://www.freetds.org/news.html 另外再補充一下 php 連結 SQL SERVER 如果遇到亂碼的話 請在 freetds.conf 設定(2010-07-27 修正) [ Somewhere ] host = 111.222.121.212 port = 1433 client charset = UTF-8 tds version = 8.0 如果 MySQL 亂碼請用 set names 'utf-8' 囉~