Welcome Guest, Not a member yet? Register   Sign In
Controllers not loading, no logging either
#1

Downloaded the latest code, uploaded it to my server and everything loaded (yeah!) no more ENV issues or logger loading issues.

I copied the home controller to pages.php and loaded it up in a browser and I get a 404 error - and - the URL changes from /pages to /public/pages
I try to load the checks controller and I get a 404 error and the URL changes from /checks to /public/checks

I check out the routes.php in the config folder and add:
$routes->add('/pages', 'Pages::index');

Try again, same result.

Apart from changing the App.php in the config folder for the $baseURL, nothing else was changed. Also, changed the logging to 9, however, no log file is being written (the writable folder's permissions are 777)

No errors on the server either.
Reply
#2

What do you have in your htaccess file?
How is your config setup?
Reply
#3

the htaccess is identical to the default one in the repository
the config is identical to the default one in the repository (plus the baseURL change)

I literally downloaded the repository, changed the baseURL and uploaded it. The four steps in the installation documentation here:
https://bcit-ci.github.io/CodeIgniter4/i...index.html
(well 3, while I do have a database, I figure, one step at a time)
Reply
#4

Did you set your paths up in the .application/config/paths.php

That's were the public directory is set.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

Try removing the leading slash from the route. It's a known bug that I haven't had a chance to fix, yet:

Code:
$routes->add('pages', 'Pages::index');
Reply
#6

(This post was last modified: 05-30-2017, 11:54 AM by Kaosweaver.)

The paths.php file was not changed. the paths on the server match the paths in the paths.php file.
I'm getting a CI error (not a generic 404) - CI is loading, the system dies in the startController where the $this->controller value is "Public". Specifically, it dies at line 373
Code:
throw new PageNotFoundException('Controller or its method is not found.');
Reply
#7

Changed the routes to remove the leading / and then attempted the URL as /pages and /pages/

The result is still the same, the URL changes to /public/pages (for both)
while the default root URL still loads.
Reply
#8

Oh! Completely missed one part of your original post. You need to point your domain to the public directory in the CI repository. Currently, it looks like it's pointing to the main directory (with application and system as sub-directories). That's not how CI4 is designed to work for a security best practice. Point the domain to the public folder and you should be good.
Reply
#9

(05-30-2017, 11:59 AM)kilishan Wrote: Oh! Completely missed one part of your original post. You need to point your domain to the public directory in the CI repository. Currently, it looks like it's pointing to the main directory (with application and system as sub-directories). That's not how CI4 is designed to work for a security best practice.  Point the domain to the public folder and you should be good.

It is (and was prior)
[Image: img.png]
In fact the above image's URL is http://ci4.kaosweaver.com/img.png and if you go to http://ci4.kaosweaver.com/ you see the welcome message.
Reply
#10

Sorry it took me a while to get back here. I've been completely slammed against a deadline (which I just wrapped up, yay!).

Trying to follow your steps:

- I pulled down the latest code
- Copied Controllers/Home.php to Controllers/Pages.php
- Renamed the the class to Pages in the new file
- Made the index method output something different so I knew I was there.
- fired up the local server (php serve.php) and visited localhost:8080/pages in my browser and what I expected showed up. I noticed if I try /pages on your site it works as expected currently, too.

Since that worked, I tried adding the same route that you had ($routes->add('/pages', 'Pages::index')Wink and things still work for me.

Finally, realizing I hadn't set my path, I went and edited Configi/App.php and set base_url to 'http://localhost:8080'. That finally gave me the standard Whoops! error. So, I create a simple .env file with a single line (CI_ENVIRONMENT=development) so that I could see the actual error, and it's throwing an error with CodeIgniter\HTTP\URI::resolveRelativeURI() .

But that's the only error I could get it to create (and I need to go figure out why now....) Your site seems to be working. What did you figure out for you?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB