Welcome Guest, Not a member yet? Register   Sign In
Routing error in CI 4.0.0-rc.1

(This post was last modified: 09-23-2019, 12:19 AM by ComN'Stay.)

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 !!!

<?php namespace App\Controllers;

    use CodeIgniter\Controller;

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


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

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?

(This post was last modified: 09-23-2019, 08:46 AM by ComN'Stay.)

(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 :

 i've put the phpinfo in attachment and the only error i'va got is :
[proxy_fcgi:error] [pid 19818] [client] AH01071: Got error 'Primary script unknown\n'

Attached Files
.pdf   phpinfo().pdf (Size: 1.32 MB / Downloads: 1)

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.

Theme © iAndrew 2016 - Forum software by © MyBB