我在本地機器(OSX 10.6.6,Rails3.0.1,WEBrick)
中編寫了導軌應用程序。簡單驗證碼正常工作。當我將應用程序推送到我的網絡服務器(Centos5.5,Rails 3.0.1,Phusion Passenger version 3.0.2)
時,沒有發現錯誤,但圖像不顯示在站點中。驗證碼圖像不適用於我的製作環境但開發良好
我注意到/tmp
有一些文件,如simple_captcha20110324-19769-1bf4hah.jpg
。我在我的服務器中打開它,圖像是驗證碼圖像。所以我認爲驗證碼生成工作正常,但在生產環境中出現了問題。我跟蹤過程,發現ioctl(27, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffc3fad550) = -1 ENOTTY (Inappropriate ioctl for device)
。你有什麼建議嗎?
strace的信息:
...
stat("/tmp/simple_captcha20110324-3073-14fnzd6.jpg", {st_mode=S_IFREG|0600, st_size=1808, ...}) = 0
stat("/tmp/simple_captcha20110324-3073-14fnzd6.jpg", {st_mode=S_IFREG|0600, st_size=1808, ...}) = 0
geteuid() = 500
getegid() = 500
getuid() = 500
getgid() = 500
access("/tmp/simple_captcha20110324-3073-14fnzd6.jpg", R_OK) = 0
open("/tmp/simple_captcha20110324-3073-14fnzd6.jpg", O_RDONLY) = 27
ioctl(27, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffc3fad550) = -1 ENOTTY (Inappropriate ioctl for device)
brk(0x63b0000) = 0x63b0000
write(3, "\n\nStarted GET \"/simple_captcha/e"..., 133) = 133
clock_gettime(CLOCK_REALTIME, {1300937319, 188732000}) = 0
writev(11, [{"Status: ", 8}, {"200", 3}, {"\r\n", 2}, {"X-Powered-By: ", 14}, {"Phusion Passenger (mod_rails/mod"..., 44}, {"\r\n", 2}, {"Content-Disposition", 19}, {": ", 2}, {"inline; filename=\"simple_captcha"..., 37}, {"\r\n", 2}, {"Content-Transfer-Encoding", 25}, {": ", 2}, {"binary", 6}, {"\r\n", 2}, {"Content-Type", 12}, {": ", 2}, {"image/jpeg", 10}, {"\r\n", 2}, {"Cache-Control", 13}, {": ", 2}, {"private", 7}, {"\r\n", 2}, {"X-UA-Compatible", 15}, {": ", 2}, {"IE=Edge,chrome=1", 16}, {"\r\n", 2}, {"Set-Cookie", 10}, {": ", 2}, {"_newuser_session=BAh7CEkiD3Nlc3N"..., 275}, {"\r\n", 2}, {"X-Sendfile", 10}, {": ", 2}, ...], 39) = 623
shutdown(11, 1 /* send */) = 0
close(11) = 0
...
UPDATE:
我覺得有些錯誤在https://github.com/galetahub/simple-captcha可能。我選擇了這個分支https://github.com/kares/simple_captcha所有的env工作正常!
sudo apt-get install imagemagick libmagickwand-dev ....我無法看到簡單的驗證碼圖像,所以找到imagemagick沒有安裝,所以安裝後,我看到圖像:) ..... – 2015-07-13 15:48:32