2012-03-22 113 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秒...