Problem deploying with Laravel Cashier included

If you’re using Laravel Cashier, you may have had an issue deploying to Fly. You may see something like this

#10 0.606 
#10 0.606   Problem 1
#10 0.606     - moneyphp/money is locked to version v4.0.5 and an update of this package was not requested.
#10 0.606     - moneyphp/money v4.0.5 requires ext-bcmath * -> it is missing from your system. Install or enable PHP's bcmath extension.
#10 0.606   Problem 2
#10 0.606     - moneyphp/money v4.0.5 requires ext-bcmath * -> it is missing from your system. Install or enable PHP's bcmath extension.
#10 0.606     - laravel/cashier v13.15.1 requires moneyphp/money ^3.2|^4.0 -> satisfiable by moneyphp/money[v4.0.5].
#10 0.606     - laravel/cashier is locked to version v13.15.1 and an update of this package was not requested.

I added php${PHP_VERSION}-bcmath to my Dockerfile and it seems to have worked.

Edit your dockerfile that was generated by fly to contain this:

Starting at line 12:

RUN apt-get update && apt-get install -y \
    git curl zip unzip rsync ca-certificates vim htop cron \
    && apt-get install -y --no-install-recommends php8.1-bcmath \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* \

You can see we add bc-math, since fly primarily uses dockers to build images, we can add custom extensions, however you will need to change the php version to whatever version you’re using.

Thanks! I’ll add that into the Dockerfile that’s created so others don’t have to hit that issue.

Appreciate you letting us know!

I’m not sure we need to put this in the dockerfile. This problem occurs because he is using cashier and not everyone is using.

1 Like