codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.4k stars 1.9k forks source link

Docs: Note for No input file specified #6542

Closed neznaika0 closed 2 years ago

neznaika0 commented 2 years ago

PHP Version

7.4

CodeIgniter4 Version

4.2.6

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

apache

Database

No response

What happened?

On one of the hosting reg.ru there is a problem "No input file specified" I believe that this is an incorrect server setting (related due to nginx or php-cgi), they write about it on other resources. The problem was solved by changing public/.htaccess on the RewriteRule ^([\s\S]*)$ index.php [L,NC] I don’t know how common this error is, maybe it’s worth adding a note about this to the documentation? https://codeigniter.com/user_guide/installation/troubleshooting.html for example this: If you encounter a No input file specified error, try changing htaccess to "code example"

Steps to Reproduce

Move files from localhost to shared hosting

Expected Output

Must run app

Anything else?

No response

kenjis commented 2 years ago

Thank you for reporting.

Can your config handle the URL with query strings like http://example.com/foo?page=1? Can you get $_GET['page']?

And there is another way:

RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]

from https://forum.codeigniter.com/showthread.php?tid=77365

neznaika0 commented 2 years ago

Now I cant check if the site is working. I tried to start the router in different ways - index.php does not find it. Could only open https://example.com/index.php?/foo?page=1

neznaika0 commented 2 years ago

RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]

Yes, this rules work. Added ? solves the problem

kenjis commented 2 years ago

@neznaika0 Thank you for your feedback! I sent a PR: #6545