Restler always returns not found

I am stuck here, in wamp I run everything and work fine, however, when I tried to install api in the centos field, I always get the "Not Found" error.

I do not know what else to do!

Even the say / hello example does not work ...

Is there any specification of apache requirements for handling a restyler?

Any ideas ?, it's kind of urgent

say.php:

<?php class Say { function hello($to='world') { return "Hello $to!"; } } 

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

 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:

Not Found The requested URL / mylocation / say / hello was not found on this server.

Basically, all my code, if you guys think jsonpformat might go my way, I can paste this code here.

When I type url like this: http://myhost/mylocation/ I get a json error:

 { "error": { "code": 404, "message": "Not Found" } } 

If I type http://myhost/mylocation/say/hello , then I get an error not found , its like .htaccess does not work.

[EDIT]

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 that way ...

I got this from: Restler returns a 404 status code if index.php is not included in the URL

+4
source share
1 answer

Ok, I found a problem, thanks everyone for your help.

The solution was to set the AllowOverride variable of the AllowOverride file to All instead of None . As soon as I tried it to work :)

Other than mod_rewrite apache, I did not find another requirement for running restler, if so, I will edit this and put it here.

I found this to be a common restler problem , and it would be nice to mention this in the documentation, hope this can help you.

PD : I have to say that it is very annoying when they reject me, editing my question, when it has not even been a minute since I published it, however I did everything I could. You could say, "Why did you send it then?" Due to some of the requirements of a restler, it does not require a lot of details to answer this ...

+6
source

Source: https://habr.com/ru/post/1433030/


All Articles