1

I am upgrading from Craft 2 to Craft 4 and this is the first time I'm deploying a Craft 4 website. It was entirely unclear how to do this, as just uploading the files to an FTP server does not work because of Composer. My workaround was to just copy and paste all symlinked files to the vendor folder, however when I want to install a plugin on a production website I get the following error:

Composer was unable to install the updates due to a dependency conflict.
Error: The command "'php' '/var/www/vhosts/domainname.com/httpdocs/app/storage/runtime/composer.phar' 'update' 'craftcms/contact-form' '--with-all-dependencies' '--working-dir' '/var/www/vhosts/domainname.com/httpdocs/app' '--no-scripts' '--no-ansi' '--no-interaction'" failed.
Exit Code: 2(Misuse of shell builtins)
Working directory: /var/www/vhosts/domainname.com/httpdocs

Error Output:
================


Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- craftcms/cms[4.4.8, ..., 4.8.x-dev] require ext-bcmath * -> it is missing from your system. Install or enable PHP's bcmath extension.
- Root composer.json requires craftcms/cms ^4.4.0 -> satisfiable by craftcms/cms[4.4.0-beta.1, ..., 4.8.x-dev].

You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-bcmath to temporarily ignore these required extensions.
Composer output: Loading composer repositories with package information
Updating dependencies

I have never used composer before this and I am completely lost. I have spend over 10 hours on this problem and haven't gotten a step closer. I figured out that with SSH I can access my FTP, but on there I can't install composer.

2 Answers 2

2

The answer is in your error message. The PHP extension BCMath is required by Craft, per the CraftCMS requirements docs.

I.e.: Your server is not configured correctly.

2

There's tons of resources to get you up to speed on Composer, and a lot of the web uses it so this will help you out across different setups as well!

If you don't have composer on your hosting server, you will need to run all of the Composer work locally and make sure that you're uploading everything via your FTP. Be sure to upgrade Craft 3 before trying to upgrade to Craft 4, using the provided guides: https://craftcms.com/docs/3.x/upgrade.html

Its important not to skip any migration or project-config steps with this. Run composer install locally and craft update to ensure all of your libraries and dependencies are taken care of. Take note of any error output from running these, as they need to be addressed before uploading. You will need to ensure you're uploading the entire vendor folder to your server, as you've indicated that you aren't setup to use composer there.

For the specific error you posted - you need to update your server's PHP .ini file to allowe the bcmath extension, as one of the libraries requires it (referring to Install or enable PHP's bcmath extension.) As a heads up, this is Composer's job... telling you when something a library requires to work on your setup is missing or has a conflict. The error is not with composer's setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.