![]() |
Page displays 'index.php' - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9) +--- Thread: Page displays 'index.php' (/showthread.php?tid=90561) Pages:
1
2
|
Page displays 'index.php' - microchip - 04-03-2024 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. RE: Page displays 'index.php' - luckmoshy - 04-03-2024 App/Config/app PHP Code: public string $indexPage = 'index.php'; remove index.php RE: Page displays 'index.php' - kenjis - 04-03-2024 Try the tutorial. https://codeigniter4.github.io/CodeIgniter4/tutorial/index.html RE: Page displays 'index.php' - microchip - 04-03-2024 (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. RE: Page displays 'index.php' - kenjis - 04-03-2024 Where did you go in that tutorial? What did you do? and what did you get? RE: Page displays 'index.php' - microchip - 04-03-2024 Creating controller, views and templates. Upon running, the page shows index.php as text RE: Page displays 'index.php' - kenjis - 04-03-2024 Do you mean you are there? https://codeigniter4.github.io/CodeIgniter4/tutorial/static_pages.html#running-the-app RE: Page displays 'index.php' - kenjis - 04-03-2024 (04-03-2024, 07:52 AM)microchip Wrote: Creating controller, views and templates. How did you access the page exactly? The exact URI? RE: Page displays 'index.php' - microchip - 04-05-2024 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? RE: Page displays 'index.php' - Bosborne - 04-05-2024 [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. |