使用swift openstack的php云文件时出现内部服务器错误


Internal Server Error when using php cloud files with swift openstack

我目前在使用tempauth的SAIO安装上使用php can文件作为swift的API。执行php文件:

 require('cloudfiles.php');
 $username="test:teste";
 $api_key="AUTH_tkfec9a726c0584d3d8f0150eb36446fd4";
 $auth = new CF_Authentication($username, $api_key);
 $auth->authenticate();
 if ( $auth->authenticated() )
     echo "CF Authentication successful 'n";
 else
     echo "Authentication faile 'n";

由于身份验证问题,执行失败:

PHP致命错误:未捕获异常"AuthenticationException",消息为"无效的用户名或访问密钥"。

用户名和api_key是正确的(用swift命令测试过,我可以在swift上对容器进行操作?我想知道它在身份验证时是如何工作的?有什么想法吗

您没有提供身份验证主机URL,因此默认值为https://auth.api.rackspace.com.这可能就是问题所在。

Btw。应该将函数封装在try-catch块中。

echo "Authentication faile 'n";

将永远不会被调用,因为如果authenticate()不抛出异常,它总是返回true。