Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Restler总是返回“未找到”_Php_Web Services_Api_Rest_Restler - Fatal编程技术网

Php Restler总是返回“未找到”

Php Restler总是返回“未找到”,php,web-services,api,rest,restler,Php,Web Services,Api,Rest,Restler,我被困在这里,在wamp中,我运行一切,工作正常,然而,当我试图在centos盒中安装api时,总是出现“找不到”错误 我不知道还能做什么 即使是say/hello示例也失败了 是否有处理restler的apache需求规范 有什么想法吗?有点紧急 say.php: <?php class Say { function hello($to='world') { return "Hello $to!"; } } 如果我键入http://myhost/mylo

我被困在这里,在wamp中,我运行一切,工作正常,然而,当我试图在centos盒中安装api时,总是出现“找不到”错误

我不知道还能做什么

即使是say/hello示例也失败了

是否有处理restler的apache需求规范

有什么想法吗?有点紧急

say.php:

<?php
class Say {
    function hello($to='world') {
        return "Hello $to!";
    }
}
如果我键入
http://myhost/mylocation/say/hello
然后我得到了未找到错误,类似于。htaccess不工作

[编辑]

如果我像这样将“index.php”添加到url中,它似乎会起作用:
http://myhost/mylocation/index.php/say/hello
,但我不能就这样离开


我是从:

好的,我发现了问题,谢谢大家的帮助

解决方案是将
httpd.conf
文件的
AllowOverride
变量设置为
All
,而不是
None
。我一试它就成功了:)

除了apache的mod_rewrite之外,我没有发现运行restler的另一个要求,如果我找到了,我将编辑它并将其放在这里

我发现这是restler的一个常见问题,最好在文档中提及,希望这能对您有所帮助


PD:我必须说,在编辑我的问题时被否决是非常烦人的,因为我的问题在我发布后还没有过一分钟,但我已经尽了最大的努力。您可能会说“为什么您当时发布了它?”因为restler需求部分,回答这个问题不需要太多细节…

如果有紧急情况,您应该给我们提供更多细节。我已经完成了对这个问题的改进,但是,我真的可以使用一些有关apache和php的restler需求的信息,以防我在安装过程中遗漏了一些模块或扩展。您的
.htaccess
文件似乎没有问题,因此您可能在
mod_rewrite
-方面有问题。实际上@moonwave99我必须将httpd.conf文件的de AllowOverride变量设置为All,而不是none。这绝对是应该在Restler的“入门”部分明确说明的内容。谢谢你,丹尼尔。
<?php
    require_once 'restler/restler.php';
    require_once 'say.php';

    $r = new Restler();
    $r->addAPIClass('Say');

    $r->setSupportedFormats('jsonpformat', 'jsonformat', 'xmlformat', 'yamlformat');
    $r->handle();
DirectoryIndex index.php
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^$ index.php [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
    php_flag display_errors On
</IfModule>
{
  "error": {
    "code": 404,
    "message": "Not Found"
  }
}