The error you're encountering is due to the mb_rtrim() function not being recognized, which suggests that the mbstring extension might not be properly enabled or recognized by the PHP CLI (Command Line Interface) even though it is enabled in your php.ini for the web server.
Here are steps to troubleshoot and resolve the issue:
-
Verify PHP CLI Configuration:
- Run
php -i | findstr /i "Loaded Configuration File"in your command line to check whichphp.inifile is being used by the PHP CLI. Ensure that this is the samephp.inifile where you have enabledmbstring.
- Run
-
Ensure
mbstringis Enabled for CLI:- Open the
php.inifile that is being used by the CLI (as identified in the previous step). - Make sure the line
extension=mbstringis uncommented (remove the;at the beginning if present).
- Open the
-
Restart Command Line or Terminal:
- After making changes to
php.ini, restart your command line or terminal to ensure the changes take effect.
- After making changes to
-
Check PHP Version Consistency:
- Ensure that the PHP version used by your web server and CLI are the same. You can check the CLI version by running
php -v.
- Ensure that the PHP version used by your web server and CLI are the same. You can check the CLI version by running
-
Reinstall Laravel Installer:
- If the above steps do not resolve the issue, try reinstalling the Laravel installer:
composer global remove laravel/installer composer global require laravel/installer
- If the above steps do not resolve the issue, try reinstalling the Laravel installer:
-
Check for Composer Path:
- Ensure that the Composer global bin directory is in your system's PATH. You can add it by following these steps:
- Find the Composer global bin directory by running
composer global config bin-dir --absolute. - Add this directory to your system's PATH environment variable.
- Find the Composer global bin directory by running
- Ensure that the Composer global bin directory is in your system's PATH. You can add it by following these steps:
-
Test the Installation:
- After performing the above steps, try creating a new Laravel project again:
laravel new project-name
- After performing the above steps, try creating a new Laravel project again:
By following these steps, you should be able to resolve the issue with the Laravel installer and create new projects successfully. If the problem persists, consider checking for any updates or issues reported on the Laravel GitHub repository or forums.