# Composer update to v4.4.0 become new install (update deleted local.php)

**URL:** <https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597>\
**Category:** Product Support\
**Created:** [June 27, 2022, 5:42pm UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597 "2022-06-27T17:42:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [June 27, 2022, 5:42pm UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597/1 "2022-06-27T17:42:12Z")

</div>

**Your software**  
My Mautic version is: 4.4.0  
My PHP version is: 7.4  
My Database type and version is: MySQL 5+

**Your problem**  
My problem is: Saw the tweet announcement about minor update to v4.4.0 - did an composer update and was greeted with “New Mautic Installation” page.

These errors are showing in the log:

Steps I have tried to fix the problem:

- Noticed that local.php was gone after the composer update.
- Restored only local.php file from v4.3.1 backup … Mautic site back up at v4.4.0 but I don’t know if that broke anything else …

---

<div class="post-metadata">

**Author:** ![olivierlambert](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/olivierlambert/32/7635_2.png) [@olivierlambert](https://forum.mautic.org/u/olivierlambert)\
**Post date:** [June 30, 2022, 6:50am UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597/2 "2022-06-30T06:50:39Z")

</div>

I experienced the same issue. Did a VM snapshot just before, so decided to rollback.

---

<div class="post-metadata">

**Author:** ![johnhannawin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/johnhannawin/32/7859_2.png) [@johnhannawin](https://forum.mautic.org/u/johnhannawin)\
**Post date:** [June 30, 2022, 11:37am UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597/3 "2022-06-30T11:37:20Z")

</div>

I have scripted the composer update for Mautic. I always do scripts for composer stuff after years of working with Drupal. The basic steps are:

1. Copy local.php to safety
2. Do a dry run composer: update composer update --with-all-dependencies --dry-run
3. If looks OK run for real
4. Copy back local.php
5. Run migrations: /usr/bin/php /var/www/mautic/bin/console doctrine:migration:migrate
6. Clear cache: rm -rf /var/www/mautic/docroot/var/cache/\*

I’ve used this process on that last few Mautic updates without issue.

Mautic seems to be evolving rapidly, so having a snapshot is not a bad idea as well.

---

<div class="post-metadata">

**Author:** ![olivierlambert](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/olivierlambert/32/7635_2.png) [@olivierlambert](https://forum.mautic.org/u/olivierlambert)\
**Post date:** [July 4, 2022, 7:46am UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597/4 "2022-07-04T07:46:49Z")

</div>

I think that should be probably documented. Especially if you said you tested it with success since few updates, it’s great to know it!

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 4, 2022, 8:08am UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597/5 "2022-07-04T08:08:18Z")

</div>

Hi folks!

@favourchi is working on updating the docs relating to installing/updating Mautic over this next week - it would be great to share some insights with her for the composer based side of things. Please drop into #composer on Slack (get an invite at [Mautic Community On Slack](https://mautic.org/slack)) if you would like to contribute to making the docs better!

---

<div class="post-metadata">

**Author:** ![johnhannawin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/johnhannawin/32/7859_2.png) [@johnhannawin](https://forum.mautic.org/u/johnhannawin)\
**Post date:** [July 4, 2022, 9:52am UTC](https://forum.mautic.org/t/composer-update-to-v4-4-0-become-new-install-update-deleted-local-php/24597/6 "2022-07-04T09:52:16Z")

</div>

Here’s my script, I don’t do Slack but by all means share this with anyone, there’s nothing fancy in it but it does what I need.

```auto
#!/bin/bash
BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m'

# Set these for your installation
MDIR="/var/www/mautic"
BDIR="/var/www/backup"
COMPOSER="/usr/local/bin/composer"

# Are we running as the mautic user? (probably www-data)
if [[$EUID -ne 33]]; then
   echo "This script must be run as www-data" 
   exit 1
fi

# Save local.php
cp $MDIR/docroot/app/config/local.php $BDIR

# Do dry run
cd $MDIR
composer update --with-all-dependencies --dry-run

# Check we are happy to run for real
while true; do
    read -p "Are you happy to run this for real?" yn
    case $yn in
        [Yy]* ) composer update --with-all-dependencies; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

# Copy local.php back
cp $BDIR/local.php $MDIR/docroot/app/config
chmod g+w $MDIR/docroot/app/config/local.php

# Done

echo "Mautic Upgraded, running any migrations."

# Run any migration
/usr/bin/php /var/www/mautic/bin/console doctrine:migration:migrate

# Clear the cache
rm -rf $MDIR/docroot/var/cache/*

# Done

echo "Mautic updated, migrated and cache cleared"

```
