CodeIgniter Forums
Routing Issue - Windows vs Linux - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forum-9.html)
+--- Thread: Routing Issue - Windows vs Linux (/thread-66265.html)



Routing Issue - Windows vs Linux - krishg - 09-29-2016

I am migrating from CI 2.x to 3.0. I tested the migrated code on my Windows machine and it works fine.

I am testing now on AWS Linux box and stuff is breaking.

Getting 404s on my home page. The 404 message is The requested page ,, was not found

To debug, I dumped the my_router object from Codeigniter.php after the load class 
Code:
$RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL);
echo '<pre>';
print_r($RTR);

Here are some snippets from the dump 
Non working machine - AWS Linux
MY_Router Object
[module] => pages
[config] => CI_Config Object

          ... identical between the 2 machines
[routes]
         ... identical between two machines 
Code:
[routes] => Array
       (
           [about-us] => pages/view/about-us
           [our-mission] => pages/view/our-mission
           [404_override] => pages/view
           [404] => index/page_404
           [events/view/(.+)] => index/page_404
           [venues/view/(.+)] => index/page_404
           [artists/view/(.+)] => index/page_404
           [event/([a-zA-Z0-9_-]+)] => index/page_404
           [event/([a-zA-Z0-9_-]+)/([a-zA-Z_-]+)] => index/page_404
           [event/([a-zA-Z0-9_-]+)/([a-zA-Z_-]+)/([a-zA-Z_-]+)] => index/page_404
           [event/([a-zA-Z0-9_-]+)/([a-zA-Z_-]+)/([a-zA-Z_-]+)/([0-9])] => index/page_404
           [venue/([a-zA-Z0-9_-]+)] => index/page_404
           [venue/([a-zA-Z0-9_-]+)/([0-9])] => index/page_404
           [event/(.+)] => events/view/$1
           [artist/(.+)] => artists/view/$1
           [venue/(.+)] => venues/view/$1
           [admin] => admin
           [admin/change-password] => admin/change-password
           [admin/update-maintenance-mode] => admin/views/update-maintenance-mode
           [admin/([a-zA-Z_-]+)] => $1/admin/index
           [admin/([a-zA-Z_-]+)/(.+)] => $1/admin/$2
           [admin/([a-zA-Z_-]+)/(.+)/(.+)] => $1/admin/$2/$3
       )

[class] =>                          Note: (empty) --> Not sure why!
[method]=>index
[directory]=>../modules/pages/controllers
[default_controller] => index
On a Windows machine where the migrated solution works correctly, the MY_ROUTER dump snippet is

[module]=> index
[class] => index
[method]= index
[directory] ../modules/index/controllers/
[default_controller] => index/index

I am puzzled as to why the pages module is being loaded on the Linux machine first whereas the index module is being loaded first on Windows machine . Also the default controller is different. I copied the exact set of files from the Windows machine to linux box. PHP version on AWS is 5.6.25 and 5.6.22 on Windows.

Comparing logs between machines the Index MX_controller class never seems to be get initialized in the Linux machine. 

I wonder if this is a case sensitive issue

Any pointers appreciated.


RE: Routing Issue - Windows vs Linux - dave friend - 09-30-2016

It likely is a "case" issue. At least that would be the first place to look.
Check out this upgrading doc for more info.


RE: Routing Issue - Windows vs Linux - krishg - 09-30-2016

Thanks. Yeah, that was it. I didn't realize that I had to change all the model files in my modules directory to UpperCase first.


RE: Routing Issue - Windows vs Linux - Narf - 10-03-2016

'Index' controllers are documented as "reserved names" and shouldn't be used.

They are not technically reserved by the framework itself, but since you'll likely have an index() method as well, that would be triggered as a PHP4-style constructor, so ...


RE: Routing Issue - Windows vs Linux - krishg - 10-03-2016

(10-03-2016, 12:48 AM)Narf Wrote: 'Index' controllers are documented as "reserved names" and shouldn't be used.

They are not technically reserved by the framework itself, but since you'll likely have an index() method as well, that would be triggered as a PHP4-style constructor, so ...

Thank you.