• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI in apache userdirs (domain.com/~user/public/ci)

#11
The router is first breakpoint hit:

Quote:/home/kaimartin/www/hiperplanner/app/Config/Routes.php

If I match any url to the stock Home controller ($routes->get('/(:any)', 'Home::index'); ), I can get the splash page. This supports what the 404 error has been indicating all along: that the router is trying to match the mod_userdir part of the url to a controller.

What is the next step for verifying the router's base for matching?
Reply

#12
Quote:@evansharp,
If I match any url to the stock Home controller ($routes->get('/(:any)', 'Home::index'); ), I can get the splash page. This supports what the 404 error has been indicating all along: that the router is trying to match the mod_userdir part of the url to a controller.

Great progress. I prefer not to modify the original installation and modify the Routes.php to load a NewController.php.

Copy the Home.php Controller to a NewController.php. Numerous modifications to the NewController.php are required to accept the new Routes.php instructions. Also create new NewController.php methods and ensure the URL activates the relevant methods.

Also activate .htaccess and test for "Pretty Urls".
Reply

#13
Hi John, 

I don't think it's good progress at all, it just confirms the issue I suspected in the first place: mod_userdir urls are choking the router.

I am not suggesting to modify system files? I was asking if you knew how to echo the string the Router is using as the base for recognizing segments, since that is the problem, and how to configure it. 

i.e. what string does the router class match the request url against to separate the domain and install directory from the controller and method segments?

The router is trying to find a controller called "~kaimartain" when it should be recognizing that no controller URL segment exists. This is where I think mod_rewrite is coming into play, since the router can only use the url provided by apache for the request. If it is inconsistent due to mod_userdir, then the router is working on the wrong input data.

The solution of inserting a (:any) wildcard into every route definition is no solution at all, so I'm back to trying to configure the router properly before trying to create more controllers.
Reply

#14
I tried looking at what the Request object was providing to the router. I added this to the top of Router.php:

PHP Code:
$request = \Config\Services::request();
$uri $request->uri;
echo (string)
$request->uri


The result was domain.com/~kaimartin/hiperplanner/~kaimartin/hiperplanner

So even though the url in the browser looks right, the trailing segments are being duplicated somewhere by the request class?
I removed the RewriteBase directive from all the .htaccess files with no effect.

Ideas?
Reply

#15
I did a level 6 trace on apache's rewrite for one request to the baseUrl.

Everything looks correct and the passthrough path is what it should be for CI to work. So the duplication of the userdir url segments is happening in the CI request class before it gets to the router.
Reply

#16
My CI4 knowledge only stretches as far as simple web sites. I have no experience of having multiple users accessing the same web site.

I've noticed you raised a Support ticket and hope someone more knowledgeable can be of assistance Sad
Reply

#17
(03-22-2021, 03:46 PM)John_Betong Wrote: My CI4 knowledge only stretches as far as simple web sites. I have no experience of having multiple users accessing the same web site.

I've noticed you raised a Support ticket and hope someone more knowledgeable can be of assistance Sad

I wondered if you knew what I was talking about with apache mod_userdir. Thank you for spending the time trying to help me. I learned about path verification along the way Smile

Is there another mod you could ping who might know more about the Request class?
Reply

#18
Quote:@evansharp,
I wondered if you knew what I was talking about with apache mod_userdir.
...
Is there another mod you could ping who might know more about the Request class?


https://github.com/codeigniter4/CodeIgni...ssues/4471

The above Raised Issue should be sufficient unfortunately there are another 95 queued issues.

Hopefully CodeIgniter4 can solve this issue and will not require any additional resources?

It looks as though @kilishan, @MGatner, @paulbalandan, etc are busy but can assure you at least one of them will soon be in touch.
Reply

#19
Thanks for the report. I’ve never used mod_userdir but a cursory glance at it makes me think it should not affect CI4 of your Apache Config and .htaccess are configured accordingly. My first guess on the “doubling” is that your baseUrl is not set correctly relative to the Apache directives. Try adjusting that in Config\App and if you are still having problems see if you can recreate the issue in a barebones AppStarter repo so it is easy to reproduce.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.