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

AungHtetPaing__'s avatar

moneyphp doesn't work with php 8.2

I am trying to deploy laravel project on droplet and getting php extension error at composer install step. So I installed multiple php extension that is missing and stuck at moneyphp extension error after installed sudo apt-get install php-bcmath. The error is

Problem 1
    - moneyphp/money is locked to version v4.0.5 and an update of this package was not requested.
    - moneyphp/money v4.0.5 requires php ~8.0.0 || ~8.1.0 -> your php version (8.2.0) does not satisfy that requirement.
  Problem 2
    - moneyphp/money v4.0.5 requires php ~8.0.0 || ~8.1.0 -> your php version (8.2.0) does not satisfy that requirement.
    - laravel/cashier v13.16.0 requires moneyphp/money ^3.2|^4.0 -> satisfiable by moneyphp/money[v4.0.5].
    - laravel/cashier is locked to version v13.16.0 and an update of this package was not requested.

What should i do? Thank for any advice.

0 likes
10 replies
AungHtetPaing__'s avatar

@Tray2 When I run composer update on local it updated moneyphp to version 4.1 so I pushed and pulled from droplet. It seem like it is solved but not really.

Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 120 installs, 0 updates, 0 removals

In Filesystem.php line 254:

  /var/www/koob/vendor does not exist and could not be created.


install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]

Do I still need to delete composer.lock from droplet?

AungHtetPaing__'s avatar

Deleted composer.lock and tried composer install. It doesn't work.

No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 120 installs, 0 updates, 0 removals
  - Locking asm89/stack-cors (v2.1.1)
  - Locking brick/math (0.10.2)
  - Locking dflydev/dot-access-data (v3.0.2)
  - Locking doctrine/inflector (2.0.6)
  - Locking doctrine/instantiator (1.4.1)
  - Locking doctrine/lexer (1.2.3)
  - Locking dompdf/dompdf (v2.0.1)
  - Locking dragonmantank/cron-expression (v3.3.2)
  - Locking egulias/email-validator (2.1.25)
  - Locking facade/flare-client-php (1.10.0)
  - Locking facade/ignition (2.17.6)
  - Locking facade/ignition-contracts (1.0.2)
  - Locking fakerphp/faker (v1.21.0)
  - Locking filp/whoops (2.14.6)
  - Locking fruitcake/laravel-cors (v2.2.0)
  - Locking graham-campbell/result-type (v1.1.0)
  - Locking guzzlehttp/guzzle (7.5.0)
  - Locking guzzlehttp/promises (1.5.2)
  - Locking guzzlehttp/psr7 (2.4.3)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking inertiajs/inertia-laravel (v0.4.5)
  - Locking laravel/breeze (v1.10.0)
  - Locking laravel/cashier (v13.16.0)
  - Locking laravel/dusk (v6.25.2)
  - Locking laravel/framework (v8.83.27)
  - Locking laravel/sail (v1.16.6)
  - Locking laravel/sanctum (v2.15.1)
  - Locking laravel/serializable-closure (v1.2.2)
  - Locking laravel/tinker (v2.7.3)
  - Locking league/commonmark (2.3.8)
  - Locking league/config (v1.2.0)
  - Locking league/flysystem (1.1.10)
  - Locking league/mime-type-detection (1.11.0)
  - Locking masterminds/html5 (2.7.6)
  - Locking mockery/mockery (1.5.1)
  - Locking moneyphp/money (v4.1.0)
  - Locking monolog/monolog (2.8.0)
  - Locking myclabs/deep-copy (1.11.0)
  - Locking nesbot/carbon (2.64.0)
  - Locking nette/schema (v1.2.3)
  - Locking nette/utils (v3.2.8)
  - Locking nikic/php-parser (v4.15.2)
  - Locking nunomaduro/collision (v5.11.0)
  - Locking opis/closure (3.6.3)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phenx/php-font-lib (0.5.4)
  - Locking phenx/php-svg-lib (0.5.0)
  - Locking php-webdriver/webdriver (1.13.1)
  - Locking phpoption/phpoption (1.9.0)
  - Locking phpunit/php-code-coverage (9.2.22)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.5.27)
  - Locking psr/container (1.1.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (2.0.0)
  - Locking psr/simple-cache (1.0.1)
  - Locking psy/psysh (v0.11.9)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (1.2.2)
  - Locking ramsey/uuid (4.7.0)
  - Locking sabberworm/php-css-parser (8.4.0)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.8)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.4)
  - Locking sebastian/exporter (4.0.5)
  - Locking sebastian/global-state (5.0.5)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.2.0)
  - Locking sebastian/version (3.0.2)
  - Locking stripe/stripe-php (v9.9.0)
  - Locking swiftmailer/swiftmailer (v6.3.0)
  - Locking symfony/console (v5.4.16)
  - Locking symfony/css-selector (v6.2.0)
  - Locking symfony/deprecation-contracts (v3.2.0)
  - Locking symfony/error-handler (v5.4.15)
  - Locking symfony/event-dispatcher (v6.2.2)
  - Locking symfony/event-dispatcher-contracts (v3.2.0)
  - Locking symfony/finder (v5.4.11)
  - Locking symfony/http-foundation (v5.4.16)
  - Locking symfony/http-kernel (v5.4.16)
  - Locking symfony/mime (v5.4.16)
  - Locking symfony/polyfill-ctype (v1.27.0)
  - Locking symfony/polyfill-iconv (v1.27.0)
  - Locking symfony/polyfill-intl-grapheme (v1.27.0)
  - Locking symfony/polyfill-intl-icu (v1.27.0)
  - Locking symfony/polyfill-intl-idn (v1.27.0)
  - Locking symfony/polyfill-intl-normalizer (v1.27.0)
  - Locking symfony/polyfill-mbstring (v1.27.0)
  - Locking symfony/polyfill-php72 (v1.27.0)
  - Locking symfony/polyfill-php73 (v1.27.0)
  - Locking symfony/polyfill-php80 (v1.27.0)
  - Locking symfony/polyfill-php81 (v1.27.0)
  - Locking symfony/process (v5.4.11)
  - Locking symfony/routing (v5.4.15)
  - Locking symfony/service-contracts (v2.5.2)
  - Locking symfony/string (v6.2.2)
  - Locking symfony/translation (v6.2.2)
  - Locking symfony/translation-contracts (v3.2.0)
  - Locking symfony/var-dumper (v5.4.14)
  - Locking theseer/tokenizer (1.2.1)
  - Locking tightenco/ziggy (v1.5.0)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.5)
  - Locking vlucas/phpdotenv (v5.5.0)
  - Locking voku/portable-ascii (1.6.1)
  - Locking webmozart/assert (1.11.0)

In JsonFile.php line 178:

  file_put_contents(./composer.lock): Failed to open stream: Permission denied


install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]

Also tried sudo chown -R $USER composer.lock. Yeah that doesn't work because there is no composer.lock file.

Sinnbeck's avatar

@AungHtetPaing__ Sounds like the user you are running composer install as isnt the owner of the folder. Make sure they are the same

1 like
AungHtetPaing__'s avatar

@sinnbeck Thank you for your reply.

@tray2 Should I run composer update on server whenever I need? Laravel daily blog said composer update shouldn't run on server.

Tray2's avatar

@AungHtetPaing__ Well you should make sure your lock file is up to date and then delete the vendors directory and then run install.

1 like
Sinnbeck's avatar

@AungHtetPaing__ deleting the vendor directory should only be necessary now that everything is broken. On regular deploys it's not needed

1 like
AungHtetPaing__'s avatar

@Sinnbeck

now that everything is broken

So you mean I still need to delete vendor directory and run composer install again? Sorry I am asking question again and again in this thread :)

Edited I should search about vendor does not exist and could not be created error before deleting composer.lock file. Now I found multiple question and answer about that error on google :/

blakroku's avatar

composer install maintains the current state of your composer.lock file, while composer update updates the dependencies in your composer.lock file. The will no need deleting the lock file.

Please or to participate in this conversation.