CodeIgniter 3 stops with "Your system folder path does not appear to be set correctly"
Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.phpShort answer
CodeIgniter 3's front controller resolves $system_path and then checks that the result is a directory. If it is not, it answers 503 with this message. So the folder is missing, named differently, or $system_path points to the wrong place. Print the resolved path, then correct the variable or put the system folder back.
Fix it fast
1Find out which cause you have
Open index.php, read the value of $system_path, and test whether that directory exists relative to the file.
grep -n "system_path =" index.php ls -ld system2Match what you see, then jump to its fix
- 1
The value in index.php (often 'system') does not match a directory next to index.php$system_path names a folder that is not thereFix - 2
ls shows no system folder, or it sits inside another folder such as CodeIgniter-3.1.13/systemThe system folder was not uploaded, or ended up one level too deepFix - 3
The site worked until index.php was moved to a public folder or copied for a second applicationindex.php was moved but the paths in it were not changedFix
- 1
What does the error look like?
Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php503 Service Unavailable
Cause 1 of 3
$system_path names a folder that is not there
1Check
The front controller turns the value into a full path and tests it with is_dir. On Linux, names are case-sensitive, so System and system are different folders.
grep -n "system_path =" index.php
ls -la | grep -i system2Fix
Make the variable match the real folder name, or give a full server path when the folder lives somewhere else.
$system_path = 'system';
// or, when the folder is elsewhere:
$system_path = '/var/www/shared/ci-system';3Verify
Reload the page. The CodeIgniter welcome page or your controller should answer.
curl -I http://localhost/Confirmed by raw.githubusercontent.com
Cause 2 of 3
The system folder was not uploaded, or ended up one level too deep
1Check
A zip extracted on the server often creates a wrapper folder, and a copy that stopped early leaves system out. The upgrade guide asks you to delete the old system folder first and then put the new one in its place.
find . -maxdepth 3 -type d -name system2Fix
Move the folder so it sits next to index.php, or point $system_path at where it really is.
mv CodeIgniter-3.1.13/system ./system3Verify
The folder is now where index.php expects it.
ls -ld system && curl -I http://localhost/Confirmed by codeigniter.com
Cause 3 of 3
index.php was moved but the paths in it were not changed
1Check
The comment in the file says to set the path if the system folder is not in the same directory as index.php. The guide to managing applications gives the same idea for $application_folder.
grep -n -E 'system_path|application_folder' index.php2Fix
Set both variables to the new location. A full path is the safest choice.
$system_path = '/var/www/my-site/system';
$application_folder = '/var/www/my-site/application';3Verify
Open the site in the browser and confirm the 503 is gone.
curl -I http://localhost/Confirmed by codeigniter.com
How do I stop it coming back?
- Keep index.php, system and application together unless you change the two path variables on purpose.
- After an upgrade, replace the system folder as a whole, not file by file.
- Use the same letter case on every machine, because Linux treats names as case-sensitive.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack end
CodeIgniter 4 cannot write its cache files
CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/
CodeIgniter 4's file cache needs a cache directory that the web server can really write to.
2 causes, each with a fixBack end
CodeIgniter 3 loads the model but the property is undefined
The model name you are loading is the name of a resource that is already being used: user
CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.
2 causes, each with a fixBack end
Composer cannot reach repo.packagist.org on port 443
Operation timed out after 300000 milliseconds
When Composer cannot reach repo.packagist.org, run composer diagnose first; it tests the connection and the certificate store.
4 causes, each with a fix