Upgrading with composer

Your software
My Mautic version is:4.4.0
My PHP version is: 7.4.30
My Database type and version is: MariaDB 10.3.34

Your problem
My problem is: Newbie question - my apologies. I did a fresh install of Mautic about a month ago, using Composer for the first time. Now that v4.3.1 has been released, how do I do an update? I tried using php bin/console mautic:update:find from the command line, but that disabled my installation (thank goodness for system snapshots!). I can’t seem to find instructions for updating with Composer. I haven’t tried updating through the Mautic UI, because I see that is recommended against. Any help would be truly appreciated.

Thanks,
Robert

These errors are showing in the log:

Steps I have tried to fix the problem:

I tried updating, but was unsuccessful. Following is the results of updating with “composer update mautic/* --with-dependencies”

root@Mautic:/var/www/html/mautic# composer update mautic/* --with-dependencies
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Loading composer repositories with package information                                                          Info from https://repo.packagist.org: #StandWithUkraine
Dependency symfony/var-dumper is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.
Updating dependencies
Lock file operations: 0 installs, 81 updates, 0 removals
  - Upgrading aws/aws-sdk-php (3.222.1 => 3.232.1)
  - Upgrading composer/ca-bundle (1.3.1 => 1.3.3)
  - Upgrading composer/composer (2.2.12 => 2.2.17)
  - Upgrading composer/spdx-licenses (1.5.6 => 1.5.7)
  - Upgrading doctrine/annotations (1.13.2 => 1.13.3)
  - Upgrading doctrine/cache (2.1.1 => 2.2.0)
  - Upgrading doctrine/dbal (2.13.8 => 2.13.9)
  - Upgrading doctrine/deprecations (v0.5.3 => v1.0.0)
  - Upgrading doctrine/event-manager (1.1.1 => 1.1.2)
  - Upgrading doctrine/orm (2.12.1 => 2.12.3)
  - Upgrading doctrine/persistence (2.5.1 => 2.5.3)
  - Upgrading doctrine/sql-formatter (1.1.2 => 1.1.3)
  - Upgrading egulias/email-validator (3.1.2 => 3.2.1)
  - Upgrading friendsofphp/proxy-manager-lts (v1.0.8 => v1.0.12)
  - Upgrading giggsey/libphonenumber-for-php (8.12.47.1 => 8.12.52)
  - Upgrading intervention/image (2.7.1 => 2.7.2)
  - Upgrading jbroadway/urlify (1.2.3-stable => 1.2.4-stable)
  - Upgrading joomla/string (1.4.6 => 2.0.0)
  - Upgrading laminas/laminas-code (4.5.1 => 4.6.0)
  - Upgrading maennchen/zipstream-php (2.1.0 => 2.2.1)
  - Upgrading monolog/monolog (1.27.0 => 1.27.1)
  - Upgrading nikic/php-parser (v4.13.2 => v4.14.0)
  - Upgrading oneup/uploader-bundle (3.2.0 => 3.2.1)
  - Upgrading paragonie/constant_time_encoding (v2.5.0 => v2.6.3)
  - Upgrading php-http/discovery (1.14.1 => 1.14.3)
  - Upgrading phpoffice/phpspreadsheet (1.23.0 => 1.24.1)
  - Upgrading phpstan/phpdoc-parser (1.4.5 => 1.6.4)
  - Upgrading symfony/cache (v4.4.41 => v4.4.44)
  - Upgrading symfony/cache-contracts (v2.5.1 => v2.5.2)
  - Upgrading symfony/config (v4.4.41 => v4.4.44)
  - Upgrading symfony/console (v4.4.41 => v4.4.44)
  - Upgrading symfony/css-selector (v4.4.37 => v4.4.44)
  - Upgrading symfony/debug (v4.4.41 => v4.4.44)
  - Upgrading symfony/dependency-injection (v4.4.41 => v4.4.44)
  - Upgrading symfony/deprecation-contracts (v2.5.1 => v2.5.2)
  - Upgrading symfony/doctrine-bridge (v4.4.41 => v4.4.44)
  - Upgrading symfony/error-handler (v4.4.41 => v4.4.44)
  - Upgrading symfony/event-dispatcher (v4.4.37 => v4.4.44)
  - Upgrading symfony/event-dispatcher-contracts (v1.1.12 => v1.1.13)
  - Upgrading symfony/expression-language (v4.4.41 => v4.4.44)
  - Upgrading symfony/filesystem (v4.4.39 => v4.4.42)
  - Upgrading symfony/finder (v4.4.41 => v4.4.44)
  - Upgrading symfony/flex (v1.18.6 => v1.19.2)
  - Upgrading symfony/form (v4.4.41 => v4.4.44)
  - Upgrading symfony/framework-bundle (v4.4.41 => v4.4.44)
  - Upgrading symfony/http-client (v4.4.41 => v4.4.44)
  - Upgrading symfony/http-client-contracts (v2.5.1 => v2.5.2)
  - Upgrading symfony/http-foundation (v4.4.41 => v4.4.44)
  - Upgrading symfony/http-kernel (v4.4.41 => v4.4.44)
  - Upgrading symfony/inflector (v5.4.3 => v5.4.11)
  - Upgrading symfony/intl (v4.4.41 => v4.4.44)
  - Upgrading symfony/lock (v5.4.7 => v5.4.10)
  - Upgrading symfony/mime (v5.4.8 => v5.4.11)
  - Upgrading symfony/monolog-bridge (v4.4.37 => v4.4.43)
  - Upgrading symfony/options-resolver (v4.4.37 => v4.4.44)
  - Upgrading symfony/polyfill-ctype (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-iconv (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-intl-grapheme (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-intl-icu (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-php73 (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-php74 (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-php80 (v1.25.0 => v1.26.0)
  - Upgrading symfony/polyfill-php81 (v1.25.0 => v1.26.0)
  - Upgrading symfony/process (v4.4.41 => v4.4.44)
  - Upgrading symfony/property-access (v4.4.41 => v4.4.44)
  - Upgrading symfony/routing (v4.4.41 => v4.4.44)
  - Upgrading symfony/security (v4.4.41 => v4.4.44)
  - Upgrading symfony/security-bundle (v4.4.41 => v4.4.44)
  - Upgrading symfony/service-contracts (v2.5.1 => v2.5.2)
  - Upgrading symfony/string (v5.4.8 => v5.4.11)
  - Upgrading symfony/templating (v4.4.37 => v4.4.44)
  - Upgrading symfony/translation (v4.4.41 => v4.4.44)
  - Upgrading symfony/translation-contracts (v2.5.1 => v2.5.2)
  - Upgrading symfony/twig-bridge (v4.4.41 => v4.4.44)
  - Upgrading symfony/validator (v4.4.41 => v4.4.44)
  - Upgrading symfony/var-exporter (v5.4.8 => v5.4.10)
  - Upgrading symfony/yaml (v4.4.37 => v4.4.44)
  - Upgrading tightenco/collect (v8.83.8 => v8.83.15)
  - Upgrading twig/twig (v3.3.10 => v3.4.1)
  - Upgrading voku/portable-ascii (1.6.1 => 2.0.1)
  - Upgrading webmozart/assert (1.10.0 => 1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 81 updates, 0 removals
  - Downloading symfony/flex (v1.19.2)
  - Downloading composer/spdx-licenses (1.5.7)
  - Downloading doctrine/cache (2.2.0)
  - Downloading doctrine/deprecations (v1.0.0)
  - Downloading symfony/service-contracts (v2.5.2)
  - Downloading symfony/polyfill-php80 (v1.26.0)
  - Downloading symfony/polyfill-php73 (v1.26.0)
  - Downloading symfony/console (v4.4.44)
  - Downloading symfony/polyfill-ctype (v1.26.0)
  - Downloading symfony/filesystem (v4.4.42)
  - Downloading laminas/laminas-code (4.6.0)
  - Downloading friendsofphp/proxy-manager-lts (v1.0.12)
  - Downloading doctrine/event-manager (1.1.2)
  - Downloading doctrine/dbal (2.13.9)
  - Downloading doctrine/sql-formatter (1.1.3)
  - Downloading egulias/email-validator (3.2.1)
  - Downloading symfony/process (v4.4.44)
  - Downloading symfony/options-resolver (v4.4.44)
  - Downloading symfony/finder (v4.4.44)
  - Downloading symfony/event-dispatcher (v4.4.44)
  - Downloading doctrine/annotations (1.13.3)
  - Downloading symfony/mime (v5.4.11)
  - Downloading symfony/http-foundation (v4.4.44)
  - Downloading intervention/image (2.7.2)
  - Downloading phpstan/phpdoc-parser (1.6.4)
  - Downloading joomla/string (2.0.0)
  - Downloading symfony/yaml (v4.4.44)
  - Downloading symfony/routing (v4.4.44)
  - Downloading symfony/http-client-contracts (v2.5.2)
  - Downloading symfony/debug (v4.4.44)
  - Downloading symfony/error-handler (v4.4.44)
  - Downloading symfony/http-kernel (v4.4.44)
  - Downloading symfony/dependency-injection (v4.4.44)
  - Downloading symfony/polyfill-php81 (v1.26.0)
  - Downloading symfony/config (v4.4.44)
  - Downloading symfony/var-exporter (v5.4.10)
  - Downloading symfony/cache (v4.4.44)
  - Downloading symfony/framework-bundle (v4.4.44)
  - Downloading nikic/php-parser (v4.14.0)
  - Downloading webmozart/assert (1.11.0)
  - Downloading doctrine/persistence (2.5.3)
  - Downloading symfony/expression-language (v4.4.44)
  - Downloading symfony/translation-contracts (v2.5.2)
  - Downloading symfony/validator (v4.4.44)
  - Downloading twig/twig (v3.4.1)
  - Downloading symfony/twig-bridge (v4.4.44)
  - Downloading symfony/translation (v4.4.44)
  - Downloading symfony/templating (v4.4.44)
  - Downloading symfony/polyfill-iconv (v1.26.0)
  - Downloading symfony/polyfill-intl-grapheme (v1.26.0)
  - Downloading symfony/string (v5.4.11)
  - Downloading symfony/inflector (v5.4.11)
  - Downloading symfony/property-access (v4.4.44)
  - Downloading symfony/security (v4.4.44)
  - Downloading symfony/security-bundle (v4.4.44)
  - Downloading symfony/polyfill-php74 (v1.26.0)
  - Downloading monolog/monolog (1.27.1)
  - Downloading symfony/monolog-bridge (v4.4.43)
  - Downloading symfony/lock (v5.4.10)
  - Downloading symfony/polyfill-intl-icu (v1.26.0)
  - Downloading symfony/intl (v4.4.44)
  - Downloading symfony/http-client (v4.4.44)
  - Downloading symfony/form (v4.4.44)
  - Downloading symfony/doctrine-bridge (v4.4.44)
  - Downloading symfony/css-selector (v4.4.44)
  - Downloading php-http/discovery (1.14.3)
  - Downloading maennchen/zipstream-php (2.2.1)
  - Downloading phpoffice/phpspreadsheet (1.24.1)
  - Downloading paragonie/constant_time_encoding (v2.6.3)
  - Downloading oneup/uploader-bundle (3.2.1)
  - Downloading giggsey/libphonenumber-for-php (8.12.52)
  - Downloading voku/portable-ascii (2.0.1)
  - Downloading jbroadway/urlify (1.2.4-stable)
  - Downloading composer/ca-bundle (1.3.3)
  - Downloading aws/aws-sdk-php (3.232.1)
  - Downloading doctrine/orm (2.12.3)
  - Downloading composer/composer (2.2.17)
  - Upgrading symfony/flex (v1.18.6 => v1.19.2): Extracting archive
  - Upgrading composer/spdx-licenses (1.5.6 => 1.5.7): Extracting archive
  - Upgrading doctrine/cache (2.1.1 => 2.2.0): Extracting archive
  - Upgrading doctrine/deprecations (v0.5.3 => v1.0.0): Extracting archive
  - Upgrading symfony/deprecation-contracts (v2.5.1 => v2.5.2): Extracting archive
  - Upgrading symfony/service-contracts (v2.5.1 => v2.5.2): Extracting archive
  - Upgrading symfony/polyfill-php80 (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/polyfill-php73 (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/console (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/polyfill-ctype (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/filesystem (v4.4.39 => v4.4.42): Extracting archive
  - Upgrading laminas/laminas-code (4.5.1 => 4.6.0): Extracting archive
  - Upgrading friendsofphp/proxy-manager-lts (v1.0.8 => v1.0.12): Extracting archive
  - Upgrading doctrine/event-manager (1.1.1 => 1.1.2): Extracting archive
  - Upgrading doctrine/dbal (2.13.8 => 2.13.9): Extracting archive
  - Upgrading doctrine/sql-formatter (1.1.2 => 1.1.3): Extracting archive
  - Upgrading egulias/email-validator (3.1.2 => 3.2.1): Extracting archive
  - Upgrading symfony/process (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/options-resolver (v4.4.37 => v4.4.44): Extracting archive
  - Upgrading symfony/finder (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/event-dispatcher-contracts (v1.1.12 => v1.1.13): Extracting archive
  - Upgrading symfony/event-dispatcher (v4.4.37 => v4.4.44): Extracting archive
  - Upgrading doctrine/annotations (1.13.2 => 1.13.3): Extracting archive
  - Upgrading symfony/mime (v5.4.8 => v5.4.11): Extracting archive
  - Upgrading symfony/http-foundation (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading intervention/image (2.7.1 => 2.7.2): Extracting archive
  - Upgrading phpstan/phpdoc-parser (1.4.5 => 1.6.4): Extracting archive
  - Upgrading joomla/string (1.4.6 => 2.0.0): Extracting archive
  - Upgrading symfony/yaml (v4.4.37 => v4.4.44): Extracting archive
  - Upgrading symfony/routing (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/http-client-contracts (v2.5.1 => v2.5.2): Extracting archive
  - Upgrading symfony/debug (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/error-handler (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/http-kernel (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/dependency-injection (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/polyfill-php81 (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/config (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/var-exporter (v5.4.8 => v5.4.10): Extracting archive
  - Upgrading symfony/cache-contracts (v2.5.1 => v2.5.2): Extracting archive
  - Upgrading symfony/cache (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/framework-bundle (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading nikic/php-parser (v4.13.2 => v4.14.0): Extracting archive
  - Upgrading webmozart/assert (1.10.0 => 1.11.0): Extracting archive
  - Upgrading doctrine/persistence (2.5.1 => 2.5.3): Extracting archive
  - Upgrading tightenco/collect (v8.83.8 => v8.83.15): Extracting archive
  - Upgrading symfony/expression-language (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/translation-contracts (v2.5.1 => v2.5.2): Extracting archive
  - Upgrading symfony/validator (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading twig/twig (v3.3.10 => v3.4.1): Extracting archive
  - Upgrading symfony/twig-bridge (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/translation (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/templating (v4.4.37 => v4.4.44): Extracting archive
  - Upgrading symfony/polyfill-iconv (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/polyfill-intl-grapheme (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/string (v5.4.8 => v5.4.11): Extracting archive
  - Upgrading symfony/inflector (v5.4.3 => v5.4.11): Extracting archive
  - Upgrading symfony/property-access (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/security (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/security-bundle (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/polyfill-php74 (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading monolog/monolog (1.27.0 => 1.27.1): Extracting archive
  - Upgrading symfony/monolog-bridge (v4.4.37 => v4.4.43): Extracting archive
  - Upgrading symfony/lock (v5.4.7 => v5.4.10): Extracting archive
  - Upgrading symfony/polyfill-intl-icu (v1.25.0 => v1.26.0): Extracting archive
  - Upgrading symfony/intl (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/http-client (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/form (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/doctrine-bridge (v4.4.41 => v4.4.44): Extracting archive
  - Upgrading symfony/css-selector (v4.4.37 => v4.4.44): Extracting archive
  - Upgrading php-http/discovery (1.14.1 => 1.14.3): Extracting archive
  - Upgrading maennchen/zipstream-php (2.1.0 => 2.2.1): Extracting archive
  - Upgrading phpoffice/phpspreadsheet (1.23.0 => 1.24.1): Extracting archive
  - Upgrading paragonie/constant_time_encoding (v2.5.0 => v2.6.3): Extracting archive
  - Upgrading oneup/uploader-bundle (3.2.0 => 3.2.1): Extracting archive
  - Upgrading giggsey/libphonenumber-for-php (8.12.47.1 => 8.12.52): Extracting archive
  - Upgrading voku/portable-ascii (1.6.1 => 2.0.1): Extracting archive
  - Upgrading jbroadway/urlify (1.2.3-stable => 1.2.4-stable): Extracting archive
  - Upgrading composer/ca-bundle (1.3.1 => 1.3.3): Extracting archive
  - Upgrading aws/aws-sdk-php (3.222.1 => 3.232.1): Extracting archive
  - Upgrading doctrine/orm (2.12.1 => 2.12.3): Extracting archive
  - Upgrading composer/composer (2.2.12 => 2.2.17): Extracting archive
Package lightsaml/lightsaml is abandoned, you should avoid using it. Use litesaml/lightsaml instead.
Package misd/phone-number-bundle is abandoned, you should avoid using it. Use odolbeau/phone-number-bundle instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package symfony/inflector is abandoned, you should avoid using it. Use EnglishInflector from the String component instead.
Package symfony/swiftmailer-bundle is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
141 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony recipes are disabled: "symfony/flex" not found in the root composer.json

What about running composer global require symfony/thanks && composer thanks now?
This will spread some 💖  by sending a ★  to the GitHub repositories of your fellow package maintainers.

Executing script php -r "if(file_exists('./.git')&&file_exists('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''))){copy('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''),'./.git/hooks/pre-commit');} if(file_exists('./.git')&&file_exists('./build/hooks/post-checkout')){copy('./build/hooks/post-checkout','./.git/hooks/post-checkout');}" [OK]
Executing script php -r "if(file_exists('./.git/hooks/pre-commit')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/pre-commit',0755);} if(file_exists('./.git/hooks/post-checkout')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/post-checkout',0755);}" [OK]

> find . -mindepth 2 -type d -name .git | xargs rm -rf

I then cleared the cache:

root@Mautic:/var/www/html/mautic# rm -rf /var/www/mautic/docroot/var/cache/*
root@Mautic:/var/www/html/mautic# bin/console cache:clear

 // Clearing the cache for the prod environment with debug false


 [OK] Cache for the "prod" environment (debug=false) was successfully cleared.

Once complete, I accessed Mautic, only to find that I was still using version 4.4.0.

Can anyone tell me what I’m doing wrong?

Thanks in advance!

I had the same problem. Went back to non-composer for the moment.
Would be good to find the solution for that :slight_smile:

Is there a process to do that migration, or did you need to do a fresh install?

you basically only need to change everything from the new docroot directory back to a “non-docroot” directory. Then change all url entries inside the local.php file, change the url entries in the database (if there are some) and turn ‘composer_updates’ => 0, to ‘composer_updates’ => 1, inside the local.php file. Then empty the cache. That should do the trick. Hope i didn’t forget something.
Ah: in case you have plugins installed which depend on composer you need to deactivate them as well.

Thank you. I’m going to hold off on that to see if there is something a little less extreme. Hopefully, someone has gotten this working.

actually it is the other way around (value from 1 to zero) :wink:

This approach is actually very simple. You only need to redirect to another folder. This is faster and easier compared to a new install…

So, if I understand you correctly, you’re saying that I should copy everything in my current docroot directory, www/html, to a new directory, change everything to point at the new directory, and then update the composer _updates flag in local.php to 0. Is there any reason why I can’t just modify the composer_updates flag without making the copy? If the answer is just so that I have something to fall back on, I’d be taking a snapshot of the virtual machine prior to making these changes anyway.

Thanks for the help,
Robert

It turns out, composer_updates was already set to 0. I tried setting it to 1 and running a composer update, but that didn’t work.

Alex, what do you mean by “you basically only need to change everything from the new docroot directory back to a “non-docroot” directory”? What is the ‘new docroot directory’? How is that different from the docroot directory? I assume that is my www/html directory.

Thanks,
Robert

If you read the instructions on how to switch to composer you will see that the folder structure of Mautic changed. So if you have composer-Mautic you will have your mautic folder and inside you will have a “docroot” folder.
If you want to switch to a non-composer-Mautic you need to put the files from the docroot folder to the parent Mautic folder.

I hope this clarifies it.