php-crud-api icon indicating copy to clipboard operation
php-crud-api copied to clipboard

Can't access MyController

Open fallenruby opened this issue 3 years ago • 0 comments

Hi, I have installed php-crud-api on a webserver with Apache 2.4 and PHP 7.4.3 (Virtualmin). I'm using api.php with a custom controller called MyController (MyController.php).

$config = new Config([
        'address' => '127.0.0.1',
        'port' => '3306',
        'username' => 'username',
        'password' => 'password',
        'database' => 'database',
        'customControllers' => 'MyController',
        'debug' => true
]);

I tried with the default .htaccess, but I get No input file specified. at every request. So I've changed the .htaccess in:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ api.php?/$1 [QSA,L]
</IfModule>

note the question mark after api.php: RewriteRule ^(.*)$ api.php?/$1 [QSA,L]

With this modification everything works as expected since I can easly get results with api.domain.com/records/table

The thing that does not work it's MyController, I have this error: "Route '/products/1' not found". I think that is a .htaccess or a apache misconfiguration. Do you have any hint on this? Thank you

fallenruby avatar Aug 19 '22 11:08 fallenruby