执行Composer Update时Laravel依赖ext-mbstring缺失报错的解决方案
Hey there, let's get this sorted out quickly. The error you're seeing is straightforward—your PHP 7.1 installation doesn't have the mbstring extension installed, which is a required dependency for Laravel 5.6. Since you're using Debian/Ubuntu's apt package manager, here's the step-by-step fix:
Install the mbstring extension for PHP 7.1
First, update your package list and install the extension with this command:sudo apt-get update && sudo apt-get install php7.1-mbstringThe
updateensures you're pulling the latest package information before installing.Verify the extension is enabled
After installation, confirm thatmbstringis loaded in your CLI PHP environment by running:php -m | grep mbstringIf you see
mbstringprinted in the output, the extension is ready to use.Re-run Composer Update
Head back to your project directory and execute the update command again:composer updateThis time, Composer should resolve the dependencies without the missing extension error.
Optional: Restart your web server (if needed)
If you plan to run this Laravel project on a web server like Apache, you'll want to restart the server to ensure the extension is loaded for web requests too:
# For systemd-based systems (Ubuntu 16.04+) sudo systemctl restart apache2 # For older systems using init.d sudo service apache2 restart
内容的提问来源于stack exchange,提问作者Ray Coder

