2012-03-22 118 views
0

我試圖從Ubuntu服務器11.10運行我的PHP應用程序。這個應用程序在Apache + PHP的窗口下工作正常。我有其他的應用程序,我可以簡單地複製2操作系統之間的粘貼&,他們都在兩個工作。Linux上的PHP curl:在Windows上捲曲有什麼區別?

但是,這一個使用php庫補品(RESTful webservices),並使我們的PHP cURL模塊。問題是我沒有收到錯誤信息,導致無法找到問題。

我(必須)使用NTLM身份驗證,這與AuthenNTLM Apache模塊進行:

order deny,allow 
deny from all 
allow from 127.0.0.1 
Satisfy any 

由於這些文件僅僅是:

Order allow,deny 
Allow from all 

PerlAuthenHandler Apache2::AuthenNTLM 

AuthType ntlm 

AuthName "Protected Access" 

require valid-user 

PerlAddVar ntdomain "domainName server" 

PerlSetVar defaultdomain domainName 

PerlSetVar ntlmsemtimeout 2 

PerlSetVar ntlmdebug 1 

PerlSetVar splitdomainprefix 0 

是捲曲需要獲取覆蓋AuthenNTLM認證的所有文件fectehd來自同一臺服務器的cURL,訪問權限可以限制在本地主機上。

可能的問題是:

  • NTLM身份驗證不被覆蓋,通過捲曲(即使所有的AllowOverride設置)

  • 捲曲的工作方式不同Linux上的請求的文件

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_COOKIE, $strCookie); 
    curl_setopt($ch, CURLOPT_URL, $baseUrl . $queryString); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    
    $html = curl_exec($ch); 
    curl_close($ch); 
    
  • 其他?

Apache日誌說:

[錯誤]錯誤/缺少NTLM /基本認證頭的/myApp/webservice/local/viewList.php

但這個目錄應該重寫NTLM身份驗證

編輯:使用

從窗戶curl命令行訪問相同的資源,我得到:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html> 
    <head> 
     <title>406 Not Acceptable</title> 
    </head> 
    <body> 
     <h1>Not Acceptable</h1> 
     <p>An appropriate representation of the requested resource /myApp/webservice/myResource could not be found on this server.</p> 
     Available variants: 
     <ul> 
     <li><a href="myResource.php">myResource.php</a> , type application/x-httpd-php</li> 
     </ul> 
     <hr> 
     <address>Apache/2.2.20 (Ubuntu) Server at localhost Port 80</address> 
    </body> 
</html> 
+0

我覺得這個帖子會更適合[sf] – Lix 2012-03-22 12:11:53

回答

1

的問題是在Ubuntu默認的Apache配置:

Options Indexes FollowSymLinks MultiViews 

多視圖從myResource改變REQUEST_URI到myResource.php。

解決方案:

  • 禁用多視圖在.htaccess:選項-MultiViews
  • 從默認的配置
  • 刪除多視圖文件爲例重命名爲myResourceClass

我最終選擇了最後一個選項這應該工作,無論配置,我只有3個這樣的文件,所以變化需要約30秒...