问题描述
我在这里卡住了,在我WAMP运行一切工作正常,但是,当我试图安装我的API中的一个CentOS中,我总是得到一个Not Found错误。
I'm stuck here, in wamp I run everything and works fine, however, when I tried to install my api in a centos box, I always get a "Not Found" error.
我不知道自己还能做什么!
I dont know what else to do!
连发言权/你好例如失败...
Even the say/hello example fails...
有处理restler的阿帕奇要求任何规格?
Is there any specification of the apache requirements to handle restler?
任何想法?这是一种迫切
Any ideas?, it is kind of urgent
say.php:
<?php
class Say {
function hello($to='world') {
return "Hello $to!";
}
}
的index.php
index.php
<?php
require_once 'restler/restler.php';
require_once 'say.php';
$r = new Restler();
$r->addAPIClass('Say');
$r->setSupportedFormats('jsonpformat', 'jsonformat', 'xmlformat', 'yamlformat');
$r->handle();
的.htaccess
.htaccess
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>
错误:
未找到
所请求的URL / mylocation /说/招呼在此服务器上找到。
Not FoundThe requested URL /mylocation/say/hello was not found on this server.
这就是基本上所有我的code,如果你们认为jsonpformat可能在我的方式steping我可以在这里粘贴code。
Thats basically all my code, if you guys think that jsonpformat might be steping in my way I could paste that code here.
当我像这样输入的网址:的http://为myhost / mylocation /
我得到一个JSON错误:
When I type the url like this: http://myhost/mylocation/
I get a json error:
{
"error": {
"code": 404,
"message": "Not Found"
}
}
如果我输入的http://为myhost / mylocation /说/你好
然后我得到在未找到错误,其状如的.htaccess ISN 'T工作。
If I type http://myhost/mylocation/say/hello
then I get the not found error, its like .htaccess isn't working.
这似乎工作,如果我加的index.php像这样的网址: HTTP://myhost/mylocation/index.php/say/hello
,但我不能离开它像这样...
It seems to work if I add "index.php" to the url like this: http://myhost/mylocation/index.php/say/hello
, but I can't leave it like this...
我得到这个来自:<一href=\"http://stackoverflow.com/questions/8796479/restler-returns-404-status-$c$c-if-index-php-is-not-included-in-url?rq=1\">Restler返回404状态code如果在网址不包括的index.php
I got this from: Restler returns 404 status code if index.php is not included in URL
推荐答案
好吧,我发现这个问题,感谢大家的帮助。
Ok, I found the problem, thanks everyone for your help.
解决的办法是设置的的AllowOverride
变量的httpd.conf
文件复制到所有
而不是无
。只要我想,它的工作:)
The solution was to set the AllowOverride
variable of the httpd.conf
file to All
instead of None
. As soon as I tried that it worked :)
除了的mod_rewrite 的Apache,我没有找到另外一个要求运行restler,如果我这样做,我将修改这一点,并把它放在这里。
Besides the mod_rewrite of apache, I didn't find another requirement to run restler, if I do, I'll edit this and put it here.
我发现,这是一个常见的问题的 restler ,这会是个不错提到它在文档中,希望这可以帮助你。
I found that this is a common issue with restler and it might be good to mention it in the documentation, hope this can help you.
PD :我必须说,这是非常恼人的,而我的编辑问题被否决时,它甚至没有经过一分钟,因为我的贴吧,不过我也一样快,我可以。你可能会说:为什么YOUT贴吧呢?由于restler要求的一部分,所以并不需要太多的细节,回答...
PD: I must say that is very annoying to be voted down while editing my question when it didn't even passed a minute since I posted it, however I did as fast as I could. You might say "why did yout posted it then?" Because of the restler requirements part, it doesn't require much detail to answer that...
这篇关于Restler总是返回未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!