Windows Process Execution on PHP with Double Quotes
Posted on 2009-01-19 • (0)
I had a so-called “poll” on Win32 PHP (chinese only), which actually was simply a nag of problems writing code on PHP with cross-platform support (Windows and Linux are in my mind), especially when dealing with file system and command execution — without telling in detail. The complaint had been well hidden in another blog post, but since I don’t want to dive into unconstructive criticism, I just refrain from posting the whole thing here without digging into detail. Until now. That’s lucky, as some more information is revealed, and the situation is not as crappy as I expected. Here goes the first one.
Problem executing commands with more than 2 double quotes
The most frequently used command execution functions in PHP include exec(), system() and so on. They have a common problem: no more than 2 double quotes allowed. For example:
<?php system('"C:\Program Files\ImageMagick\display.exe" "C:\Document and Settings\user\Great Pic.jpg"'); ?>
Such commands are actually pretty common, with space in program path as well as arguments that followed. Regardless of program execution privilege or whatever, the system() itself already fails.
People used to know this for 2 years or more, yet no cure exists. Funny schemes were invented to circumvent such problem, there are at least 2 on PHP website comments:
[......]
Pwnie award
Posted on 2008-08-22 • (1)
真是不知這個用中文怎樣說,「千瘡百孔泛黑大獎」也不足言其英文含意之萬一。給 WordPress 的這個獎姍姍遲來,對我而言有點遲過頭了,雖然總好過沒有。但頒這個獎也是實情。君不見在 SecurityFocus 個個星期它都榜上有名!還要個個大鑊,即使不是 WordPress 本身,也是一些很多人用的[......]
OpenOffice 之:死屍還魂
Posted on 2008-06-26 • (0)
上星期才說封印 OpenOffice,今天就已經忍不住要再開一次。為甚麼?死不心息。在寫上一篇 blog 時,其實想到一個方法,將 background 圖片硬塞進 template 裏面,但並未實證過;經我那些低級 luser-wannabe skillz 實戰一次:
作為將來取笑自己用的笑料,完整方法記錄如下:
[......]
永遠放棄 OpenOffice
Posted on 2008-06-20 • (9)
我很天真,我很傻。
上星期開始,企圖真正用 OpenOffice 作為工作用途。結果花了整整一星期的時間(還沒有計算乘車和在家裏的時間),連弄個 presentation 的 template 都弄不到。
- 想將標題填色,no way。紋風不動。除非每張 slide 逐個逐個標題填色。
- 想將標題下的[......]
原來 ubuntu server 是這麼一回事
Posted on 2008-06-16 • (0)
之前一直看到自己的 server log 投訴 slocate 找不到 /etc/updatedb.conf,原來大半個月都沒有做 file index。奇怪了一段時間,明明那個檔案本來還在,為甚麼會忽然在升級至新版本時清除了 (→ Hardy)。
[......]
被 snort 整蠱了
Posted on 2008-06-10 • (0)
因為有些東西想測試,早幾天在自己的伺服器裝了 snort,結果卻是被它玩了一頓。昨天看看 snort 寄給我的 mail,有大量 robots.txt access:
# of from to method ========================================================================= xx xxx.xxx.xxx.xxx 202.134.73.141 WEB-MISC robots.txt access xx xxx.xxx.xxx.xxx 202.134.73.141 WEB-MISC robots.txt access ......
[......]
Linux Hater
Posted on 2008-06-04 • (0)
很久沒有那種找到知音的感覺了。雖然大多數內容都是諷刺或帶憤世嫉俗的語氣,但的確說出了許多 Linux 用家的心聲。以往也想過自己寫些甚麼的 (事實上也寫了兩篇稿給 LinuxPilot,但角度不同),但就是沒法谷着那一口烏氣去寫出來,要寫也寫不出那麼辛辣的英文語句。
不過找到臭味相投的人,都是多得 [......]