Welcome Guest, Not a member yet? Register   Sign In
Page displays 'index.php'
#1

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.
Reply
#2

(This post was last modified: 04-03-2024, 03:20 AM by luckmoshy.)

App/Config/app 
PHP Code:
public string $indexPage 'index.php'remove index.php 
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#3

Try the tutorial.
https://codeigniter4.github.io/CodeIgnit...index.html
Reply
#4

(This post was last modified: 04-03-2024, 05:20 AM by microchip.)

(04-03-2024, 03:19 AM)luckmoshy Wrote: App/Config/app 
PHP Code:
public string $indexPage 'index.php'remove index.php 


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.
https://codeigniter4.github.io/CodeIgnit...index.html

This is the tutorial I followed.
Reply
#5

Where did you go in that tutorial?
What did you do? and what did you get?
Reply
#6

Creating controller, views and templates.
Upon running, the page shows index.php as text
Reply
#7

Do you mean you are there?
https://codeigniter4.github.io/CodeIgnit...ng-the-app
Reply
#8

(04-03-2024, 07:52 AM)microchip Wrote: Creating controller, views and templates.
Upon running, the page shows index.php as text

How did you access the page exactly?
The exact URI?
Reply
#9

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?
Reply
#10

(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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB