# Critical upgrade error

**URL:** <https://forum.mautic.org/t/critical-upgrade-error/25220>\
**Category:** Product Support\
**Created:** [August 29, 2022, 11:41pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220 "2022-08-29T23:41:40Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [August 29, 2022, 11:41pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/1 "2022-08-29T23:41:40Z")

</div>

**Your software**  
My Mautic version is: 4.4.0  
My PHP version is: 7.4.3  
My Database type and version is: Maria DB 10.3.34

**Your problem**  
My problem is: I was having an issue upgrading with composer, so I decided to create a new installation by downloading the ZIP file. I installed v.4.4.0 on my new machine, imported the database, and updated my settings. No problem. Then I went and applied the upgrade to v.4.4.1. The installation looked like it went fine, but when I attempted to access the system, it crashed. Reboot did not fix anything, so I went to the logs.

These errors are showing in the log:  
[2022-08-28 06:15:10] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps\_files\_cleanup\_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/mautic/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {“maxlifetime”:14400} {“hostname”:“newmautic”,“pid”:810}  
[2022-08-28 06:55:03] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: “Cannot rename “/tmp/UrlMatcher.phpytV3Fp” to “/var/www/html/mautic/var/cache/prod/UrlMatcher.php”.” at /var/www/html/mautic/vendor/symfony/filesystem/Filesystem.php line 290 {“exception”:“[object] (Symfony\Component\Filesystem\Exception\IOException(code: 0): Cannot rename "/tmp/UrlMatcher.phpytV3Fp" to "/var/www/html/mautic/var/cache/prod/UrlMatcher.php". at /var/www/html/mautic/vendor/symfony/filesystem/Filesystem.php:290)”} {“hostname”:“newmautic”,“pid”:1100}  
[2022-08-28 06:55:03] mautic.ERROR: Symfony\Component\Filesystem\Exception\IOException: Cannot rename “/tmp/UrlGenerator.phpasZ5Yl” to “/var/www/html/mautic/var/cache/prod/UrlGenerator.php”. - in file /var/www/html/mautic/vendor/symfony/filesystem/Filesystem.php - at line 290 {“hostname”:“newmautic”,“pid”:1100}

Steps I have tried to fix the problem:

---

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [August 30, 2022, 1:29pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/2 "2022-08-30T13:29:11Z")

</div>

I forgot to mention that I performed the upgrade using the command line.

---

<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:** [August 30, 2022, 1:39pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/3 "2022-08-30T13:39:54Z")

</div>

Error log seems to show that it’s unable to modify the files so most likely a permission issue.

---

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [September 1, 2022, 3:13pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/4 "2022-09-01T15:13:27Z")

</div>

I see some installation instructions that call for setting the directory permissions as 755, and a few that recommend 775. I’m assuming that I should have used 775. Is that correct?

---

<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:** [September 1, 2022, 3:20pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/5 "2022-09-01T15:20:43Z")

</div>

What is the current permission for your /tmp/ folder?

---

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [September 1, 2022, 6:01pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/6 "2022-09-01T18:01:03Z")

</div>

/tmp is 700. What should it be?

---

<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:** [September 1, 2022, 6:47pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/7 "2022-09-01T18:47:57Z")

</div>

Try setting it to 755

---

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [September 1, 2022, 8:56pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/8 "2022-09-01T20:56:58Z")

</div>

I tried that with:  
chmod -R 755 /tmp

Now, when I attempt to update Mautic with:  
php bin/console mautic:update:apply  
php bin/console mautic:update:apply --finish

I get an error:  
An error occurred while updating the database. Check log for more details.

There are two logs. One says:  
[2022-09-01 19:50:13] mautic.NOTICE: Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘SELECT COLUMN\_NAME AS Field, COLUMN\_TYPE AS Type, IS\_NULLABLE AS `Null`, COLUMN\_KEY AS `Key`, COLUMN\_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN\_COMMENT AS Comment, CHARACTER\_SET\_NAME AS CharacterSet, COLLATION\_NAME AS Collation FROM information\_schema.COLUMNS WHERE TABLE\_SCHEMA = ‘mauticdb’ AND TABLE\_NAME = ‘email\_stats’ ORDER BY ORDINAL\_POSITION ASC’: SQLSTATE[HY000]: General error: 1 Can’t create/write to file ‘/tmp/#sql\_337\_0.MAI’ (Errcode: 13 “Permission denied”) (uncaught exception) at /var/www/html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 while running console command `doctrine:migrations:migrate` {“hostname”:“newmautic”,“pid”:1326}  
[2022-09-01 19:50:13] mautic.WARNING: Command `doctrine:migrations:migrate` exited with status code 1 {“hostname”:“newmautic”,“pid”:1326}  
[2022-09-01 19:50:13] mautic.WARNING: Command `mautic:update:apply` exited with status code 1 {“hostname”:“newmautic”,“pid”:1326}

The other says:  
[2022-09-01 19:50:13] console.CRITICAL: Error thrown while running command “doctrine:migrations:migrate --quiet --no-interaction”. Message: “An exception occurred while executing ‘SELECT COLUMN\_NAME AS Field, COLUMN\_TYPE AS Type, IS\_NULLABLE AS `Null`, COLUMN\_KEY AS `Key`, COLUMN\_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN\_COMMENT AS Comment, CHARACTER\_SET\_NAME AS CharacterSet, COLLATION\_NAME AS Collation FROM information\_schema.COLUMNS WHERE TABLE\_SCHEMA = ‘mauticdb’ AND TABLE\_NAME = ‘email\_stats’ ORDER BY ORDINAL\_POSITION ASC’: SQLSTATE[HY000]: General error: 1 Can’t create/write to file ‘/tmp/#sql\_337\_0.MAI’ (Errcode: 13 “Permission denied”)” {“exception”:“[object] (Doctrine\DBAL\Exception\DriverException(code: 0): An exception occurred while executing ‘SELECT COLUMN\_NAME AS Field, COLUMN\_TYPE AS Type, IS\_NULLABLE AS `Null`, COLUMN\_KEY AS `Key`, COLUMN\_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN\_COMMENT AS Comment, CHARACTER\_SET\_NAME AS CharacterSet, COLLATION\_NAME AS Collation FROM information\_schema.COLUMNS WHERE TABLE\_SCHEMA = ‘mauticdb’ AND TABLE\_NAME = ‘email\_stats’ ORDER BY ORDINAL\_POSITION ASC’:\n\nSQLSTATE[HY000]: General error: 1 Can’t create/write to file ‘/tmp/#sql\_337\_0.MAI’ (Errcode: 13 "Permission denied") at /var/www/html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:128, Doctrine\DBAL\Driver\PDO\Exception(code: HY000): SQLSTATE[HY000]: General error: 1 Can’t create/write to file ‘/tmp/#sql\_337\_0.MAI’ (Errcode: 13 "Permission denied") at /var/www/html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000): SQLSTATE[HY000]: General error: 1 Can’t create/write to file ‘/tmp/#sql\_337\_0.MAI’ (Errcode: 13 "Permission denied") at /var/www/html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:141)”,“command”:“doctrine:migrations:migrate --quiet --no-interaction”,“message”:“An exception occurred while executing ‘SELECT COLUMN\_NAME AS Field, COLUMN\_TYPE AS Type, IS\_NULLABLE AS `Null`, COLUMN\_KEY AS `Key`, COLUMN\_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN\_COMMENT AS Comment, CHARACTER\_SET\_NAME AS CharacterSet, COLLATION\_NAME AS Collation FROM information\_schema.COLUMNS WHERE TABLE\_SCHEMA = ‘mauticdb’ AND TABLE\_NAME = ‘email\_stats’ ORDER BY ORDINAL\_POSITION ASC’:\n\nSQLSTATE[HY000]: General error: 1 Can’t create/write to file ‘/tmp/#sql\_337\_0.MAI’ (Errcode: 13 "Permission denied")”} {“hostname”:“newmautic”,“pid”:1326}

---

<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:** [September 2, 2022, 12:33pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/9 "2022-09-02T12:33:04Z")

</div>

It still seems to be a permission issue.

---

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [September 2, 2022, 1:07pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/10 "2022-09-02T13:07:47Z")

</div>

I agree. Just don’t know what it is. Interestingly enough, is I restore to my earlier state, I’m able to update right from within the browser interface (although I know that is recommended against). Not sure if I should proceed asking that route though.

---

<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:** [September 2, 2022, 6:41pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/11 "2022-09-02T18:41:36Z")

</div>

browser? You mean the Mautic wasn’t first installed via composer?

Are you trying to convert from zip install to composer install / upgrade?

---

<div class="post-metadata">

**Author:** ![roblefko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/roblefko/32/4958_2.png) [@roblefko](https://forum.mautic.org/u/roblefko)\
**Post date:** [September 2, 2022, 8:48pm UTC](https://forum.mautic.org/t/critical-upgrade-error/25220/12 "2022-09-02T20:48:08Z")

</div>

This is a zip install, that I was attempting to upgrade using: php bin/console mautic:update:apply.

I had another installation that I’d done using composer, but when it had issues updating from v4.4.0 to v.4.4.1, I was told that I should revert to the traditional setup. Rather than do that, I figured I’d do a fresh installation of v.4.4.0 using the zip file, migrate my database over, and then upgrade to v.4.4.1. That’s where we stand now.
