Posts

php: symbol lookup error: php: undefined symbol: rl_on_new_l

由於開發上的需求需要多版本的 php 網路上有提供不少的方式 我想用看看 c9s 的 phpbrew 看看 CentOS7 指令上改了不少 這次都是用 yum 安裝套件 原本一開始執行 phpbrew 都正常 後來重開執行 phpbrew 就會出現 php: symbol lookup error: php: undefined symbol: rl_on_new_l 後來發現只要執行 php 就會出現上面的錯誤(網頁執行正常,只有 console cli 有問題) 看到 CentOS 官方論壇 也有人有類似的問題 後來在幾次的回答中終於解決了! 請先確認你的 libedit 版本是否為 el7 我系統原本是安裝 20090923-3.0_1.el5.rf 請注意後面顯示 el5 移除後在重新安裝 libedit 就可以正常 work 了 提供給各位參考看看~

Drupal7 : How to add _blank to hyper link in views ?

如果在 Drupal7 裡面想要在系統產生出來的超連結上加入 _blank 另開視窗的標籤 該怎麼做呢? 一般都會用他內建的 rewrite 功能把 但你會發現某些東西例如檔案路徑不知道怎麼生出來 可能要裝某些 Token 才有辦法知道路徑 感覺很簡單的功能確距離好遙遠阿… 不過既然 Drupal7 是 OpenSource 就自然有熱心的朋友把這功能實做出來囉! 使用的方式也很簡單 這個 case 是當你的檔案是 pdf 或 txt 時 系統會自動在 hyper link 那加上 target="_blank" 的標籤 function THEMENAME_file_link($variables) {   $file = $variables['file'];   $icon_directory = $variables['icon_directory'];   $url = file_create_url($file->uri);   $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));   // Set options as per anchor format described at   // http://microformats.org/wiki/file-format-examples   $options = array(     'attributes' => array(       'type' => $file->filemime . '; length=' . $file->filesize,     ),   );   // Use the description as the link text if available.   if (empty($file->description)) {     $link_text =...

Drupal 7 : How to remove viewpoint meta data ?

這問題的需求在於客戶網站不要支援 RWD (Responsive Web Resign) 由於我用 Drupal7 + Bootstrap 3.x Bootstrap 3.x 似乎內建就把這些 RWD 給設定好了 沒辦法透過後台 admin 設定 網路上看到人家說要改掉 meta tag 最多的方式都是用 html_header_alter() 但根本沒用阿… 原因在於 viewpoint 這個 meta 不是經由 html_header_alter() 產生的 後來找到用 javascript 的方式解決了 由於我是手機才需要加入這段 js 去 override 掉原本的 meta 所以我使用 mobiledetect 這個 lib 來達到我要的效果 將 viewpoint 的 content 改成 width = 1024 (px) 至於要設定多少就看你的畫面是設計給怎樣解析度看的 code 如下: function your_module_init() {   // call Mobile_Detect lib   require_once libraries_get_path('Mobile_Detect').'/Mobile_Detect.php';   $detect = new Mobile_Detect;   if ($detect->isMobile()) {     drupal_add_js("     viewport = document.querySelector(\"meta[name=viewport]\");     viewport.setAttribute('content', 'width=1024');     ", 'inline');   } } Reference Can I change the viewport meta tag in mobile safari on the fly?

'.\mysql-bin.000078' not found (Errcode: 2 - No such file or directory)

如果你的 mysql 有開啟 log-bin 那麼在 data 資料夾下就會有一堆的 mysql-bin.00001 等依序產生的檔案 這個檔案超過 1G 或是重開就會繼續產生下一個 (在 production mode 這些是很重要的) 但在測試的環境下還蠻占空間的 上次無意識的把他刪除了 今天要開啟 mysql 才發現無法啟動 會出現下面錯誤訊息: 2014-01-26 19:47:57 8844 [Note] Plugin 'FEDERATED' is disabled. 2014-01-26 19:47:57 8844 [Note] InnoDB: The InnoDB memory heap is disabled 2014-01-26 19:47:57 8844 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2014-01-26 19:47:57 8844 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-01-26 19:47:57 8844 [Note] InnoDB: Not using CPU crc32 instructions 2014-01-26 19:47:57 8844 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-01-26 19:47:57 8844 [Note] InnoDB: Completed initialization of buffer pool 2014-01-26 19:47:57 8844 [Note] InnoDB: Highest supported file format is Barracuda. 2014-01-26 19:47:57 8844 [Note] InnoDB: 128 rollback segment(s) are active. 2014-01-26 19:47:58 8844 [Note] InnoDB: Waiting for purge to start 2014-01-26 19:47:58 8844 [Note] InnoD...

Drupal : 如何使用同個資料庫但套用不同的 Theme ?

你會不會有這樣的需求? 當這個網站要讓電腦跟手機看到 雖然說 Responsive Design 可以解決大部分的問題 這邊 Subsite 不適用的原因是 雖然 users、roles、sessions 可以共用 但我要的不是另外架一個子站 整個站的資料不要跟主站有所分離 說白了就是 同一個網站要有不同的 view by device 如果你遇到這個問題你會怎麼處理? mobile app 嵌入的 web view 讀到的網頁不要 header 跟 footer (只要 content) 但如果你在 mobile 上瀏覽的網站卻要是正常的(有 header & footer) 其實如果只有單一個網頁個別處理是 ok 的 可以在路徑上面多個參數 搭配 theme function 或 template 去做變化 如果該頁是 view 又有 intra link 可能就會破功 來試試看「 Themekey 」吧! Themekey 就好像是個 for theme 的 Rules 他內建可以 trigger 的 event 相當多 不像 Rules 在不熟悉的時後會覺得使用上沒有頭緒 Themekey 的運作很簡單 先挑選一個 Properties(event),然後在選擇 Operator,再設定 Value 即可 現在假設我要的目的是 電腦跟手機連到同個網站在資料需要一致下,你打算怎麼做? 我一開始想說在網址列多個參數做識別 例如 http://www.facebook.com 跟 http://www.facebook.com/ ?device=mobile 這時候我選的 PROPERTIES 是 SYSTEM:QUERY_STRING Operator 選擇 = Value 設成成 device=mobile 這是 work 的 但有 intra link 的頁面會遇到上面說的問題 後來又想說如果說取得網址時在 meta data 塞些資料識別 但這樣似乎又太麻煩 其實他的 Properties 裡面還有 SYSTEM:USER_AGENT 可以直接針對不同 device 導到不同 Theme 去 後來看到 SYSTEM:HOST 有種一語驚醒夢中人的感覺 直接...

如何找到之前 compile 的指令

因為手殘的關係 不小心把之前紀錄 compile 指令的檔案砍了 想說原本的 compile 的 source 裡面應該有當時下的 compile 參數 果不其然! 在 source 的 config.nice 裡面 #! /bin/sh # # Created by configure './configure' \ '--prefix=/usr/local/php5' \ '--with-apxs2=/usr/local/apache2/bin/apxs' \ '--with-mysql=/usr/local/mysql' \ '--with-mysqli=/usr/local/mysql/bin/mysql_config' \ '--with-config-file-path=/usr/local/php5' \ '--enable-mbstring' \ '--enable-ftp' \ '--with-zlib' \ '--with-regex=php' \ '--with-xmlrpc' \ '--with-gd' \ '--enable-gd-native-ttf' \ '--enable-exif' \ '--with-jpeg-dir=/usr/lib' \ '--with-png-dir=/usr/lib' \ '--with-freetype-dir=/usr/lib' \ '--with-xpm-dir=/usr/lib' \ '--with-gettext' \ '--enable-soap' \ '--with-pdo-mysql=/usr/local/mysql' \ '--with-mhash' \ '--with-mcrypt' \ '--with-openssl' \ '--with-curl' \ '--enabl...

The cmdb add entry failed

剛想對 VPN User 做刪除或編輯的動作 但系統會跳出「The cmdb add entry failed」 查了一下有人說重開可能會解決 (大概有十個月沒重開了) 果然就解決了! PS. 要刪除 VPN User 需要先把他所屬的 group 移除 環境: Fortigate 80C