關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • 編譯 MySQL 的 “Linux thread not found” 問題

    Posted on October 31st, 2007 Sam Tang No comments

    今日安裝一台新 Server,系統是 RHEL 5,在編譯 MySQL 4.0.x 的時候出現問題:

    # ./configure –prefix=/usr/local/mysql
    checking “LinuxThreads”… “Not found”
    configure: error: This is a linux system and Linuxthreads was not
    found. On linux Linuxthreads should be used. Please install Linuxthreads
    (or a new glibc) and try again. See the Installation chapter in the
    Reference Manual for more information.

    看來 MySQL 4.0 不支援新核心使用了 NTPL 這種新的線程,最後用了這個方法解決:

    # cp /usr/include/pthread.h /usr/include/pthread.h.bak
    # echo ‘/* Linuxthreads */’ >> /usr/include/pthread.h

    然後重新編譯及加入 –with-pthread 及 –with-named-thread-lib 兩個參數:

    # ./configure –with-pthread –with-named-thread-lib=-lpthread
    # make && make install

    這樣就可以正常編譯及安裝 MySQL 4.0 了。


  • 同時安裝多個版本的 IE

    Posted on October 29th, 2007 Sam Tang 1 comment

    今日找到一個十分實用的工具: Multiple IE Installer,它是一個可以同時安裝所有舊版本 Internet Explorer 到 Windows 系統的免費工具程式,那麼即使已經升級到 Internet Explorer 7 的用戶也可以使用舊版 IE。它對從事網頁設計的朋友十分實用,因為可以在一部電腦內看到網頁在幾個 IE 版本的呈現效果。


  • .htaccess 實用範例

    Posted on October 28th, 2007 Sam Tang No comments

    以下是一些實用的 .htaccess 範例,可以不改動 php.ini 及 httpd.conf 便設定伺服器變數:

    關閉 magic_quotes_gpc

    # Only if you use PHP
    <ifmodule mod_php4.c>
    php_flag magic_quotes_gpc off
    </ifmodule>

    減少 Bandwidth 使用量

    # Only if you use PHP
    <ifmodule mod_php4.c>
    php_value zlib.output_compression 16386
    </ifmodule>

    變更 scripts 副檔名

    AddType application/x-httpd-php .php4

    以上語句會將 .php4 當成 PHP 程式編譯。

    禁止 .htaccess 開放瀏覽

    <files file-name>
    order allow,deny
    deny from all
    </files>

    變更預設頁面

    DirectoryIndex myhome.htm index.htm index.php

    自訂錯誤頁面

    ErrorDocument 403 /forbidden.html
    ErrorDocument 404 /notfound.html
    ErrorDocument 500 /servererror.html

    開放/禁止瀏覽目錄

    # 禁止
    Options All -Indexes
    # 開啟
    Options +Indexes


  • 紐約時報開放程式碼

    Posted on October 28th, 2007 Sam Tang No comments

    與其他報章一樣,紐約時報逐步將傳統印刷轉移到互聯網,而他們的開發團隊也釋出兩個開源專案。

    XSL Cache 是紐約時報在他們網站 cache stylesheets 的 PHP extension;而 DBSlayer 則是解決 LAMP scaling 引致資料庫重複進程,而產生資料庫連線過多問題。

    官方網站: http://open.nytimes.com/


  • 微軟售出八千八百萬套 Vista

    Posted on October 28th, 2007 Sam Tang No comments

    雖然很多機構及個人用戶也打算等到 Windows Vista SP1 推出後才升級,但根據微軟軟的公佈,從一月公開發售 Vista 開始已經售出八千八百萬套 Vista。

    但我想今年內自己也沒有升級的打算,因為平日的工作大多以編寫程式及用 Putty 管理伺服器,這些工作在 XP 已經可以滿足自己的要求,升級頂多是有了一個新的操作介面。而且升級到 Vista 要連硬件一同更換,不但浪費金錢而且十分不環保,我想起碼過了奧運才作打算。


  • 最新 Spam: MP3

    Posted on October 24th, 2007 Sam Tang 2 comments

    由上個星期開始,Spammers 已經開始由圖片及 PDF spam 轉為音效 spam。這類 spam 會附帶一個 MP3 檔案,然後便會由一把女聲讀出廣告內容。

    這個新形態垃圾郵件相對以前的垃圾郵件更難過濾,也顯示了 spammers 控制 botnets (殭屍電腦) 的技術進步。


  • 昨天換了輪胎

    Posted on October 21st, 2007 Sam Tang No comments

    舊輪胎已經用了差不多兩年,早幾個星期已經發覺雨天有推頭的感覺,昨天終於去了換輪胎,繼續使用先前用開的 Dunlop DZ101,每條 $460。我聽朋友推介過 AD07,但以我的車子 130ps 馬力來說有點浪費,我想用中價位的輪胎已經 OK。

    現在還是新胎狀態,感覺上還不是很咬地,要等輪胎上面的保護物料完全退去,現開還是開慢一點了。


  • Ubuntu 7.10 (Gutsy Gibbon) released

    Posted on October 21st, 2007 Sam Tang No comments

    期待已久的 Ubuntu 7.10 已經發佈,以下為下載連結:

    The latest releases of Ubuntu 7.10 for desktop and server are available today for download.

    Download Ubuntu

    DVD image


  • 文字模式發送帶附件電郵

    Posted on October 6th, 2007 Sam Tang 2 comments

    在 Linux/FreeBSD 的文字模式或 shell script 要發送帶有附件的電郵,可以透過 Mutt 實現,Mutt 是一個功能豐富的文字模式電郵軟件。FreeBSD 可以用 ports 安裝:

    # cd /usr/ports/mail/mutt
    # make install clean

    以下是 mutt 的使用方法:

    $ mutt -s "Email Subject" -a attachment.tar.gz to@emailaddress.co

    它的參數 -s 是郵件標題,-a 是發送的附件。如要同時發送多個附件,只要每個附件使用 -a:

    $ mutt -s "Email Subject" -a file1.tar.gz -a file2.tar.gz to@emailaddress.co

  • 不用 WGA 驗証也可安裝 IE7

    Posted on October 6th, 2007 Sam Tang No comments

    微軟准許沒有通過 WGA 驗証的 XP 系統下載 IE7,那麼即是說不論什麼原因 (包括盜版) 沒有驗証也可以安裝 IE 7。當然微軟此舉不是鼓勵盜版,很大程度上是要打擊 Firefox。

    如果因為 WGA 驗証而沒有安裝 IE7 的話,可以到以下網頁下載 IE7:

    Windows Internet Explorer 7 for Windows XP SP2


  • 微軟未經用戶同意更新系統

    Posted on October 6th, 2007 Sam Tang No comments

    一般上在使用 Windows Update 更新系統時,會先詢問使用者是否同意更新。但最近有人發現微軟在未經使用者同意下更新了最少 9 個 Windows Vista 及 XP 的檔案,而即使電腦將自動更新關閉也照樣更新了檔案。以下是會更新的檔案:

    Vista:
    1. wuapi.dll
    2. wuapp.exe
    3. wuauclt.exe
    4. wuaueng.dll
    5. wucltux.dll
    6. wudriver.dll
    7. wups.dll
    8. wups2.dll
    9. wuwebv.dl

    XP:
    1. cdm.dll
    2. wuapi.dll
    3. wuauclt.exe
    4. wuaucpl.cpl
    5. wuaueng.dll
    6. wucltui.dll
    7. wups.dll
    8. wups2.dll
    9. wuweb.dll

    如果想知道你的系統是否被更新了,可以進入 Windows -> system32,在上面列出的檔案 right click,並選擇版本。如果系統沒有被更新,版會是 5,如果版本是 7 那便代表已經更新了。


  • 我的 EditGrid 試算表

    Posted on October 3rd, 2007 Sam Tang No comments

    今日試用了 EditGrid 的網上試算表,覺得十分好用,尤其擷取遠端資料方面。花了點時間造了個觀看財經資料的試算表,在此分享一下:

    http://www.editgrid.com/user/samtang/money