Skip to content

Commit e2e255b

Browse files
authored
Merge pull request codeigniter4#7287 from kenjis/docs-add-file-case-sensitive
docs: add note for case-sensitive file systems
2 parents 5b74cd2 + 0d4c371 commit e2e255b

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

user_guide_src/source/concepts/autoloader.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ classes that your project is using. Keeping track of where every single file is,
1313
hard-coding that location into your files in a series of ``requires()`` is a massive
1414
headache and very error-prone. That's where autoloaders come in.
1515

16+
CodeIgniter4 Autoloader
17+
***********************
18+
1619
CodeIgniter provides a very flexible autoloader that can be used with very little configuration.
1720
It can locate individual namespaced classes that adhere to
1821
`PSR-4 <https://www.php-fig.org/psr/psr-4/>`_ autoloading
@@ -27,6 +30,12 @@ they work in sequence and don't get in each other's way.
2730
The autoloader is always active, being registered with ``spl_autoload_register()`` at the
2831
beginning of the framework's execution.
2932

33+
.. important:: You should always be careful about the case of filenames. Many
34+
developers develop on case-insensitive file systems on Windows or macOS.
35+
However, most server environments use case-sensitive file systems. If the
36+
file name case is incorrect, the autoloader cannot find the file on the
37+
server.
38+
3039
Configuration
3140
*************
3241

user_guide_src/source/installation/running.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ A CodeIgniter 4 app can be run in a number of different ways: hosted on a web se
99
using virtualization, or using CodeIgniter's command line tool for testing.
1010
This section addresses how to use each technique, and explains some of the pros and cons of them.
1111

12+
.. important:: You should always be careful about the case of filenames. Many
13+
developers develop on case-insensitive file systems on Windows or macOS.
14+
However, most server environments use case-sensitive file systems. If the
15+
file name case is incorrect, code that works locally will not work on the
16+
server.
17+
1218
If you're new to CodeIgniter, please read the :doc:`Getting Started </intro/index>`
1319
section of the User Guide to begin learning how to build dynamic PHP applications. Enjoy!
1420

user_guide_src/source/installation/troubleshooting.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ If you see "No input file specified", try to change the rewrite rule like the fo
5656
5757
RewriteRule ^([\s\S]*)$ index.php?/$1 [L,NC,QSA]
5858
59+
My app works fine locally but not on the production server
60+
----------------------------------------------------------
61+
62+
Make sure that the case of the folder and file names matches the code.
63+
64+
Many developers develop on case-insensitive file systems on Windows or macOS.
65+
However, most server environments use case-sensitive file systems.
66+
67+
For example, when you have **app/Controllers/Product.php**, you must use
68+
``Product`` as the short classname, not ``product``.
69+
70+
If the file name case is incorrect, the file is not found on the server.
71+
5972
The tutorial gives 404 errors everywhere :(
6073
-------------------------------------------
6174

user_guide_src/source/tutorial/static_pages.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Let's Make our First Controller
1919
Create a file at **app/Controllers/Pages.php** with the following
2020
code.
2121

22+
.. important:: You should always be careful about the case of filenames. Many
23+
developers develop on case-insensitive file systems on Windows or macOS.
24+
However, most server environments use case-sensitive file systems. If the
25+
file name case is incorrect, code that works locally will not work on the
26+
server.
27+
2228
.. literalinclude:: static_pages/001.php
2329

2430
You have created a class named ``Pages``, with a ``view()`` method that accepts

0 commit comments

Comments
 (0)