CodeIgniter Forums

Full Version: Routing error in CI 4.0.0-rc.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everybody,
first, don't be affraid of my English  Big Grin
I've read lot of topics for my problem but i've found no solution  Sad

I've install CI 4.0.0-rc.1 on my server, configure for development environment and try to acces to my project : no problem i have the CI welcome page ... good !!!

After that, i've create my first "very simple" controller in app/Controller named Admin here's the simply code !!!

<code>
<?php namespace App\Controllers;

    use CodeIgniter\Controller;

    class Admin extends Controller
    {
        public function index()
        {
             echo 'Admin area';
        }
    }

</code>

I put this line in app/Config/Routes.php :

$routes->add('admin', 'Admin::index');

and when i go to myproject/admin i've got this message on a white page (not the pretty CI 404 page) : "File not found" (you can see this at https://dev.cdsi-formation.fr)

I've testing $routes->add('admin', 'admin::index'); (all in lowercase) but it doesn't work to ...

I don't understand why that doesn't work ... please hellllllp  Angel

Thanks a lot for your future help  Wink

[edit]
i've test that in local and ... it works fine !
In local i've run PHP 7.2.21 and 7.2.22 on the sever
Is there a special server configuration for CI4 working ???
What PHP version is your server running on? Have you checked error logs on the server?
(09-23-2019, 07:00 AM)kilishan Wrote: [ -> ]What PHP version is your server running on? Have you checked error logs on the server?
for the PHP version :
7.2.22-1+0~20190902.26+debian9~1.gbpd64eb7

 i've put the phpinfo in attachment and the only error i'va got is :
[proxy_fcgi:error] [pid 19818] [client 78.212.13.127:62520] AH01071: Got error 'Primary script unknown\n'
I've found the solution !!!!
the error was in .htaccess file
i've just change the line : RewriteRule ^(.*)$ index.php/$1 [L]
by this one : RewriteRule ^(.*)$ index.php?/$1 [L]
just adding ? before the /$1
Awesome! Glad you found it. Good to have that reference here on the forum, also.