Page displays 'index.php' |
Basic install of CI4 works, producing CodeIgniter4 page.
Followed User Guide First Web Site instructions - page displays text 'index.php' Tried another new install, added new function to Home.php controller to echo a simple string - no change. Tried controller to view call. No view displayed still only 'index.php' I have PageNotFoundException setup. Is my display the output from the PageNotFoundException? I'd have expected more than that. Clearly, I've got something wrong, but where? Changed two items in Config/App.php - baseurl and index.php removal. Followed Routes.php changes as instructed. Changed apache config files, created sites-available conf file for site. (04-03-2024, 03:19 AM)luckmoshy Wrote: App/Config/app Thanks Done that. And set the Base-URL line too, as I mentioned in my original message. (04-03-2024, 04:10 AM)kenjis Wrote: Try the tutorial. This is the tutorial I followed.
Where did you go in that tutorial?
What did you do? and what did you get?
Creating controller, views and templates.
Upon running, the page shows index.php as text
Do you mean you are there?
https://codeigniter4.github.io/CodeIgnit...ng-the-app
Sorry for the delay in replying, I've reloaded the operating system and all software and am documenting every move so that I can (hopefully) repeat it.
Having followed the tutorial, I was using www.[mywebsite]/home. Interestingly, I have brought up the same error while setting up a new codeigniter4 instance and working through the various settings, e.g.$BaseUrl, CI_Environment etc. And I can repeat the behaviour. Current uri: www.[mywebsite]/public/index.php Current settings: sites-available/[mywebsite].conf - DocumentRoot -> /var/www/html/[mywebsite]/public Directory -> /var/www/html/[mywebsite] $BaseURL=www.[mywebsite]/ $IndexPage='index.php' .env CI_Environment Development Codeigniter4 download into user folder then copied to /var/www/html/[mywebsite] ownership of website directories is www-data:www-data and my user is in the www-data group. I can edit files without sudo. Access currently set to 775 throughout - yes far too much, but I want to get things working without permissions getting in the way. www.[mywebsite]/public/index.php - shows index.php as text string www.[mywebsite]/public/ - shows index.php as string www.[mywebsite]/index.php - shows Codeigniter4 welcome page www.[mywebsite]/ - shows Codeigniter4 welcome page I have created nothing in the way of web content yet. Clearly my problem was incorrect setup, but where?
04-05-2024, 09:04 AM
(This post was last modified: 04-05-2024, 09:09 AM by Bosborne. Edit Reason: Move post below )
[quote pid="417598" dateline="1712326138"]
microchip www.[mywebsite]/public/index.php - shows index.php as text string www.[mywebsite]/public/ - shows index.php as string www.[mywebsite]/index.php - shows Codeigniter4 welcome page www.[mywebsite]/ - shows Codeigniter4 welcome page I have created nothing in the way of web content yet. Clearly my problem was incorrect setup, but where? [/quote] Your last 2 lines are the expected behavior since your DocumentRoot is correctly set to the public directory. I would have expected referencing home or public to generate route errors. That initial index.php in the public folder is just a controller to start up the Codeigniter framework. |
Welcome Guest, Not a member yet? Register Sign In |