Welcome Guest, Not a member yet? Register   Sign In
CI in apache userdirs (domain.com/~user/public/ci)
#11

(This post was last modified: 03-21-2021, 04:26 PM by evansharp.)

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

(This post was last modified: 03-21-2021, 08:56 PM by John_Betong.)

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

(This post was last modified: 03-22-2021, 10:17 AM by evansharp.)

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

(This post was last modified: 03-22-2021, 10:41 PM by John_Betong.)

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
#20

I don't think the solution is in Paths.php. Nothing about the framework structure is being changed and components not found, just the install location. The Paths.php entries are all relative system paths and they are all still correct. Meanwhile, the 404 I'm getting is the CI-generated 404 page. So the framework is being located by apache ok, bootstrapped, and launched without issue.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB