Question

How do I add bcmath to the apps that I deployed to the Apps Platform?

Posted November 27, 2020 394 views
DigitalOcean App Platform
agm   | 12:26:51 Reusing cached node_modules
agm   | 12:27:00 -----> Bootstrapping...
agm   | 12:27:11 -----> Installing platform packages...
agm   | 12:27:14        - php (7.4.12)
agm   | 12:27:25        - ext-gd (bundled with php)
agm   | 12:27:25        - ext-mbstring (bundled with php)
agm   | 12:27:25        - apache (2.4.46)
agm   | 12:27:32        - nginx (1.18.0)
agm   | 12:27:36 -----> Installing dependencies...
agm   | 12:27:36        Composer version 1.10.10 2020-08-03 11:35:19
agm   | 12:27:38        Loading composer repositories with package information
agm   | 12:27:38        Installing dependencies from lock file
agm   | 12:27:38        Package operations: 81 installs, 0 updates, 0 removals

From the log above, ext-bcmath is not installed. Can I add something on the App Spec to include bcmath?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

You can just add ext-bcmath to composer.json and it will be included on build

composer require ext-bcmath
  • Those are polyfills, it works when packages does not use extension_loaded. I’m using hashids, it uses extension_loaded and a few other packages that uses Imagick, which is starting to be problematic to deploy this way.

I’m using hashids as well, works with ext-bcmath in composer.json as mentioned above

  • To be more precise: when you add it to composer.json it will show up in platform packages during build:

    ***             | 10:23:58 -----> Bootstrapping...
    ***             | 10:24:09 -----> Installing platform packages...
    ***             | 10:24:12        - php (7.3.24)
    ***             | 10:24:22        - ext-bcmath (bundled with php)