Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muuucho's avatar
Level 11

Laravel installer is broken

I suddenly had some strange error when trying to install new Laravel projects, so I upgraded my Installer to the latest one, 5.11. When I try to install a new project I get this error:

PHP Fatal error:  Uncaught Error: Call to undefined function Laravel\Installer\Console\mb_rtrim() in C:\Users\marte\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php:162
Stack trace:
#0 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Command\Command.php(279): Laravel\Installer\Console\NewCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Application.php(1029): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Application.php(316): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Installer\Console\NewCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 C:\Users\marte\AppData\Roaming\Composer\vendor\laravel\installer\bin\laravel(13): Symfony\Component\Console\Application->run()
#5 C:\Users\marte\AppData\Roaming\Composer\vendor\bin\laravel(119): include('C:\\Users\\marte\\...')
#6 {main}
  thrown in C:\Users\marte\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 162

Fatal error: Uncaught Error: Call to undefined function Laravel\Installer\Console\mb_rtrim() in C:\Users\marte\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php:162
Stack trace:
#0 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Command\Command.php(279): Laravel\Installer\Console\NewCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Application.php(1029): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Application.php(316): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Installer\Console\NewCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 C:\Users\marte\AppData\Roaming\Composer\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 C:\Users\marte\AppData\Roaming\Composer\vendor\laravel\installer\bin\laravel(13): Symfony\Component\Console\Application->run()
#5 C:\Users\marte\AppData\Roaming\Composer\vendor\bin\laravel(119): include('C:\\Users\\marte\\...')
#6 {main}
  thrown in C:\Users\marte\AppData\Roaming\Composer\vendor\laravel\installer\src\NewCommand.php on line 162

I use xampp and mbstring is enabled extension=mbstring in php.ini I can run my existing projects in this apache server, but not create new ones with the Laravel installer as expected.

0 likes
8 replies
LaryAI's avatar
Level 58

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:

  1. Verify PHP CLI Configuration:

    • Run php -i | findstr /i "Loaded Configuration File" in your command line to check which php.ini file is being used by the PHP CLI. Ensure that this is the same php.ini file where you have enabled mbstring.
  2. Ensure mbstring is Enabled for CLI:

    • Open the php.ini file that is being used by the CLI (as identified in the previous step).
    • Make sure the line extension=mbstring is uncommented (remove the ; at the beginning if present).
  3. Restart Command Line or Terminal:

    • After making changes to php.ini, restart your command line or terminal to ensure the changes take effect.
  4. 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.
  5. 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
      
  6. 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.
  7. Test the Installation:

    • After performing the above steps, try creating a new Laravel project again:
      laravel new project-name
      

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.

tykus's avatar

Make sure you are running PHP 8.4

muuucho's avatar
Level 11

@tykus Thanks,Tykus, I downgraded to v5.9.2 and now I get this error:

> build
> vite build

        error during build:
TypeError: Invalid URL
    at new URL (node:internal/url:797:36)
    at getAdditionalAllowedHosts (file:///C:/xampp/htdocs/full/node_modules/vite/dist/node/chunks/dep-BdTvomPN.js:37687:29)
    at resolveConfig (file:///C:/xampp/htdocs/full/node_modules/vite/dist/node/chunks/dep-BdTvomPN.js:53812:29)
    at async createBuilder (file:///C:/xampp/htdocs/full/node_modules/vite/dist/node/chunks/dep-BdTvomPN.js:51529:18)
    at async CAC.<anonymous> (file:///C:/xampp/htdocs/full/node_modules/vite/dist/node/cli.js:852:23)

Please or to participate in this conversation.