Category: 小小草

IT 技术领域学海无涯。其实任何领域都学海无涯,无非 IT 发展太快了,让我有更多嘘唏。希望我掌握的技术有如小小草,虽然渺小,却有旺盛的生命力。

  • Zend PHP Server is out

    事情总是很凑巧,这两天我在找 PHP Application Server,没找到理想的——

    1. Phplens 虽然有我想要的功能,但做得太粗糙,而且不免费(免费的只支持30条记录,毫无用处)。
    2. Zend Platform 高不可攀。
    3. Phpappl 虽然免费,好多年前停止更新,不敢用。

    今天 Zend 告诉我说,PHP Server 发布了(虽然还是测试版)。看来同我一样有这种需求的用户不少,被 Zend 盯上了。但各人对 application server 理解略有不同,不晓得 Zend PHP Server 是不是就是我想要的 PHP Application Server,得抽空试用一下。

  • So many bugs in ispconfig

    ispconfig 可以做 hosting account management,但给我的感觉是打磨得不够精致。如果把它应用到生产环境,如果不怕客户抱怨,如果喜欢捉虫游戏,那倒可以用 ispconfig,毕竟免费的嘛,我看功能跟 isp 自己开发的 control panel 差不多(如 godaddy 的 turbo panel)。我感觉 ispconfig 还无法跟 cPanel, plesk 相抗衡,用在开发环境还凑合。

    凭我的肉眼,我就发现了以下几个说大不大,说小不小的毛病。

    按 ispconfig installation on Fedora documentation 一步步安装完毕以后,其实并没有安装 mod_fastcgi 或 mod_fcgid (暂且算是 documentation 失误吧),但控制面板里已经可以选择 php 模式为 fastcgi。我只好自己摸索着装 mod_fcgid。

    但未装 mod_fcgid 倒没有问题,装好 mod_fcgid 重启 apache 反而会出错。因为 ispconfig.conf 里预设的 <IfModule mod_fcgid.c> 生效了,而里面一条 FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php 会出错。原因是 /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter 不存在,又得自己动手制作一个。

    另外一个问题是,新建第二个站点时,ispconfig 不会自动添加 namevirtualhost directive,导致 apache 启动时会有一个 warn message,但不致命。

    综 上,ispconfig 对 conf 文件生成和管理得不是很好,而 ispconfig 本身也是基于 apache 的 conf 来配置的,所以 ispconfig 一不小心就搞砸了,连 apache 都启动不起来,连更正的机会都没有了。用着 ispconfig,还得时刻准备着 ssh 手动去更正搞砸了的 conf 文件。

  • Do it inhouse

    技术方面,我喜欢亲力亲为,另一方面,我还没有资源可以让我不亲力亲为。

    我曾分析过 outsourcing seo 服务的弊端,here is another negative case of outsourcing email marketing.

    I received a newsletter from Tesco today, and happened to click on one of the embedded links. (I am not a newsletter reading fan. I seldom click on embedded links.)

    I got a “404 Not Found” error when I natigated to that url. After a few seconds, I became aware Tesco link tracking system is hosted on http://ad.doubleclick.net/, which is on my black list. I assume Tesco have a third party doing email marketing for them, otherwise Tesco on their own have no reason to use ad.doubleclick.net as a click tracking provider.

  • Solution to chm file error of navigation cancelled or invalid address

    最近我又对 plobe 起了兴趣,找来了一个说明文档竟然是 chm 格式。我这里用了“竟然”,因为 plobe 不是微软的技术,文档编写者却用了微软的 html help。用了微软 html help 也罢了,可它竟然打开后读不了。提示信息是:已取消到该网页的导航,或无效地址。

    我试了很多办法,但都不切中要害:

    • 修改区域和语言为中国和中文
    • 注册文件关联
    • regsvr32 某些控件
    • 从微软网站下载 hhupd.exe 来安装
    • 降低 IE 安全级别

    结果我的电脑搞得一团糟,还是没解决问题。Google 了好久(google 这回不聪明了,把好的答案藏起来了)最后解决问题的方法是:

    在 CHM 文档上右键查看属性 -> 常规 -> 在下面有一个和属性相邻的安全:此文件来自其他计算机,可能被阻止以帮助保护该计算机。 右边有一个解除锁定的按钮。

    单击一下 解除锁定 -> 应用 就可以了!

    BTW, I found this chm file is not worth opening and reading at all. Does it imply whoever compiles documentation in chm for a non-microsoft technology is silly, and whoever tries to open such a chm is silly as well? I must admit I am silly.

  • Controversial safe_mode

    safe_mode 恐怕是 php 里最有争议的环境参数了。要我说,这个参数名取得就不好,争议就难免了。safe_mode 可以设为 on / off,但并不是说 safe_mode = off 就不安全了。很多 ISP 的 shared hosting 环境下 safe_mode 也是 off 的,godaddy deluxe hosting 就是一例。

    光靠 safe_mode = on 是把不住安全关的,反而会限制某些程序的正常运行,比较麻烦。尽管麻烦,尽管我不是 share hosting,但我还是喜欢最大范围内设置 safe_mode = on。

    但是由于我习惯性使用 mod_php,最近才意识到 mod_php with safe_mode = on 在 php upload 时无法解决 “先有蛋或是先有鸡” 的问题,因为 apache 试图操作 user1 的目录。为了允许 apache 操作 user1 的目录,必须在 user1 的目录为 group 或 other 提供 write 权限。同理,为了允许 apache 操作 user2 的目录,必须在 user2 的目录为 group 或 other 提供 write 权限。这样一来,就很难隔离 user1 和 user2 之间相互的文件操作。

    suexec 对 mod_php 无效,看来只有抛弃 mod_php,改投 FastCGI 门下。

    顺便说一下,godaddy shared hosting 把 user1, user2 都归为一组,然后取消 group 读权限,允许 other (apache)读权限,虽然思路很巧妙,但有悖常规思维,通常我会认为 owner 权限 >= group 权限 >= other 权限。godaddy shared hosting 用的就是 FastCGI,不存在“鸡蛋”问题。

  • Samba can share files over internet

    Samba 太强大了,我没想到它可以在公网上共享文件和文件夹,如同在局域网内一样。

    如果给 samba server 一个公网 ip,就可以在 internet 上凭着 \\ip 就访问共享文件和文件夹。有点可怕,因为我原先认为 samba 会区别对待局域网内和局域网外用户,不经过一些特别的设置,samba server 不会让 internet 用户用 \\ip 访问共享文件和文件夹。事实不是这样,至少目前 samba 3.2.8 版不是。

    同理,如果把 WD Mybook World 建为 dmz,它的 public folder 就暴露给所有 internet users 了。

    所以得特别当心,如果想给 samba server internet visible,就不得设置 windows 局域网内共享常见的 guest 无密码访问。

  • CentOS Debian Fedora FreeBSD Ubuntu Comparison

    我还远没有资格做评测,CentOS Debian Fedora FreeBSD Ubuntu 里,除了用过 Fedora,其他的都没试用过。还有一些 linux distribution 有些近期不够活跃,有些在开源路线上不够明朗,对从零学起的用户来说,还是不用考虑把它们也加进 shortlist,就这些主流的 linux distribution 都已很让人困惑,该怎么选择?

    总的来说,选择谁都没有错,殊途同归。但可能这样的回答不会让人满意,那么根据我的研究结果,我用最短的词语来概括 CentOS Debian Fedora FreeBSD Ubuntu 特点,希望有助大家选择。

    • CentOS: 保证兼容(如果以后想买 redhat 其他产品的话)
    • Debian: 承诺免费(不用担心开发者日后见利起意)
    • Fedora: 技术追新(新版本的组件首先在 Fedora 实现,隔好久才能在 redhat 其他产品上见到)
    • FreeBSD: 发布活跃(相对Debian而言)
    • Ubuntu: 面向桌面(虽然近来在服务器领域日渐流行,但它毕竟是针对 laptop 和 desktop 设计的)
  • Cut copy paste in vim

    可能因为我刚入门 linux 吧,有些方面我还是认为它不太友好。比如在 ssh 状态使用 vim 作文本编辑器应该是绝佳的选择,我不指责它的编辑性能,倒是愣让人看不明白。难道它就非得用晦涩的文字写 manual?

    我无奈转向 google,一下子就找到了常人通俗易懂的语言,归纳如下:

    Cut 的等效快捷键
    dd delete current line
    D delete from cursor to end of line
    d$ delete from cursor to end of line
    d0 delete from cursor to beginning of line
    dw delete from cursor to end of current word
    db delete from cursor to beginning of current word

    Copy 的等效快捷键
    Y or yy copy (yank) one line
    2Y copy two lines
    10Y copy 10 lines
    yG copy all lines to the end of the file
    yw copy text from the current cursor position to the end of the word
    y$ copy text from the current cursor position to the end of the line

    Paste 的等效快捷键
    P paste above the current cursor position
    p paste below the current cursor position

  • I am with Fedora

    今天 Fedora 11 alpha 发布了。Fedora 10 我还没摸熟呢,Fedora 11 就来了,真让我高兴之中疲于奔命。

    无意中还发现 drupal, mediawiki, planet, wordpress 都包含在 Fedora 发行包中,这是不是跟 Fedora Project 自身使用了这几种技术有关?我的意思是:为什么不包含别的 packages,比如 magento, joomla, etc?

    Fedora 倡导的东西咱就支持一下。不管有用没有,咱全安装了(也就 drupal 暂时派不上用场)。

  • Actinic discounts.fil is giving away secrets

    I have many good reasons to dislike Actinic. One of the reasons is – as growing up to an Actinic expert, one can also be an Actinic hacker. In other words, Actinic is not nicely secured by the vendor. If an Actinic user wants enhanced security, he / she will work ten times harder to close the security hole.

    For example, Actinic does not have online database. Actinic keeps most of data offline, but it must have some data at server side, so itstores data in various files. This is a very doubtful approach. Of course all database software have bugs, but could Actinic file-based data do better than mysql, etc?

    Another example, I recently found Actinic stops recognising coupons after an update. During diagnosis, I found discounts.fil under acatalog folder serves as data file for coupon code etc. acatalog/discounts.fil can be accessed by public by default. All promotion secrets are exposed to competitors / customers by analysing this file. Coupon codes are hashed in discounts.fil, and hashing makes all original coupon codes not recognisable. The Actinic perl script does not compare hashed customer input coupon with hashed coupon code in discounts.fil. It compares raw customer input coupon with hashed coupon code in discounts.fil (of course they will not match). This is a bug in Actinic.

    I think closing security hole is out of most Actinic users’ capability. What is the point for an advanced Actinic user working so hard on Actinic?