Critical upgrade error

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:

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

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

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?

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

/tmp is 700. What should it be?

Try setting it to 755

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}

It still seems to be a permission issue.

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.

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

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

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.