Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

CodeIgniter 3 stops with "Your system folder path does not appear to be set correctly"

ErrorYour system folder path does not appear to be set correctly. Please open the following file and correct this: index.php

Short 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.

  • Applies to CodeIgniter 3.1, PHP 8.1, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 system
  2. 2Match what you see, then jump to its fix

    1. 1The 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. 2ls 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. 3The 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

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.php
  • 503 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 system

2Fix

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

Did this fix it?

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 system

2Fix

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 ./system

3Verify

The folder is now where index.php expects it.

ls -ld system && curl -I http://localhost/

Confirmed by codeigniter.com

Did this fix it?

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.php

2Fix

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

Did this fix it?

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

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 fix

Back 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.