composer create-project for CodeIgniter 4 stops with a requirements problem
CodeIgniter 4 problem installing with composerShort answer
Composer checks your machine against what CodeIgniter 4 requires before it installs anything. The framework needs PHP 8.2 or newer, the intl and mbstring extensions enabled, and Composer 2.0.14 or later. List what Composer sees with composer show --platform, then fix whichever of the three is missing.
Fix it fast
1Find out which cause you have
Ask Composer which PHP version and which extensions it sees. This is the PHP that runs on the command line, which can be a different one from your web server's.
composer --version php -v composer show --platform2Match what you see, then jump to its fix
- 1
composer show --platform does not list ext-intl or ext-mbstringThe intl or mbstring extension is not enabledFix - 2
composer show --platform prints a php version below 8.2The PHP that Composer uses is older than 8.2Fix - 3
composer --version prints a version below 2.0.14Composer itself is older than 2.0.14Fix
- 1
What does the error look like?
CodeIgniter 4 problem installing with composercomposer create-project codeigniter4/appstarter
Cause 1 of 3
The intl or mbstring extension is not enabled
1Check
The CodeIgniter 4 requirements page names intl and mbstring as required extensions that must be enabled. Check them in the PHP that Composer runs.
composer show --platform | grep -E "ext-intl|ext-mbstring"2Fix
Enable the extension in the php.ini that this PHP loads. The PHP manual says to remove the semicolon in front of the extension line, and that the extension name can be used instead of the file name since PHP 7.2. If you build PHP yourself, configure it with --enable-intl.
; php.ini
extension=intl
extension=mbstring3Verify
Restart the web server if you use one, then list the platform packages again.
composer show --platform | grep -E "ext-intl|ext-mbstring"Confirmed by codeigniter4.github.io
Cause 2 of 3
The PHP that Composer uses is older than 8.2
1Check
The requirements page says PHP 8.2 or newer is required, and that PHP 8.2 needs CodeIgniter 4.2.11 or later. Read the php line in the platform list.
composer show --platform | grep -E "^php "2Fix
Run Composer with a PHP of 8.2 or newer. If several PHP versions are installed, call the right binary explicitly with the Composer file.
php8.3 composer.phar create-project codeigniter4/appstarter project-root3Verify
The platform list shows the new version, and the install runs.
composer show --platform | grep -E "^php "Confirmed by codeigniter4.github.io
Cause 3 of 3
Composer itself is older than 2.0.14
1Check
The installation page says CodeIgniter 4 requires Composer 2.0.14 or later.
composer --version2Fix
Update Composer with its self-update command. For a local composer.phar, the Composer manual shows php composer.phar self-update.
php composer.phar self-update3Verify
Check the version, then create the project.
php composer.phar --version
php composer.phar create-project codeigniter4/appstarter project-rootConfirmed by codeigniter4.github.io
How do I stop it coming back?
- Run composer show --platform on a new machine before the first install, so gaps show up before the error does.
- Use the exact command from the CodeIgniter installation page, run in the folder above where the project should live.
- Keep one PHP version for both the command line and the web server, or name the binary you mean.
- Do not use --ignore-platform-req to get past this; the Composer manual says it forces the installation although the requirement is not met.
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
Servers
Composer reports a different PHP version than php -v on Ubuntu
You are running 8.1.2.
Composer takes its PHP version from the interpreter that runs it, unless config.platform fakes one.
3 causes, each with a fixBack end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
Apache returns 403 when a URL contains %3F
a request like /page%3Fname=test is refused while /page?name=test works
Recent Apache httpd blocks a rewrite when the request contains an encoded question mark (%3F) and the rewritten target has a literal ?.
2 causes, each with a fixBack end
Apache returns 500 with Premature end of script headers
500 Internal Server Error
Apache ran your script, but the script printed no valid HTTP header before its output.
3 causes, each with a fixBack 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 fix