Skip to Content

Update from Mautic 4 to 5.1 when installed by softaculous (Quick Guide)

Estimated Reading Time: 4 Minutes

Quick Guide to Upgrade Mautic from v4.4 to 5.1 (Softaculous Installation)

This guide provides a step-by-step process to upgrade Mautic from v4.4 to v5.1 when the original installation was done via Softaculous.

    1. Save local.php Configuration: Copy all the file content to a text file.
    2. Clear Cache:
php bin/console cache:clear
    1. Delete All But Some var Files.
    2. Replace Old Mautic with New Mautic Files.
    3. Replace local.php Config File.
    4. Clear Cache Again:
php bin/console cache:clear

Run Update Command:

php bin/console mautic:update:apply --finish

Clear Cache Again:

php bin/console cache:clear
    • Check .htaccess File.
    • Modify Permissions:
chmod +x /path/to/your/mautic/bin/console
find /path/to/your/mautic -type d -exec chmod 755 {} \;
find /path/to/your/mautic -type f -exec chmod 644 {} \;

Reconfigure the Email SMTP Configuration in Mautic:

    • Navigate to Mautic > Configuration > Email Settings
    • Reconfigure the SMTP settings as needed

Check PHP Version

Ensure you are using PHP 8.1 as it works great with Mautic 5.1.

Sample .htaccess Configuration


# Use the front controller as index file.
DirectoryIndex index.php

RewriteEngine On

# Set Authorization header for OAuth2 for when PHP is running under fcgi
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Determine the RewriteBase automatically and set it as environment variable.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

# Redirect to URI without front controller to prevent duplicate content
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

# If the requested filename exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

# Rewrite all other queries to the front controller.
RewriteRule .? %{ENV:BASE}/index.php [L]

# When mod_rewrite is not available, redirect the start page to the front controller
RedirectMatch 302 ^(?!/(index\.php|app|addons|plugins|media|upgrade))(/(.*))$ /index.php$2

# Prevent directory listing
Options -Indexes

# Deny access to .htaccess itself

Require all denied

# Protect configuration files
<FilesMatch "(^\.|wp-config\.php|php\.ini|php5\.ini|\.user\.ini|\.htaccess|\.htpasswd)">
Require all denied

# Deny access to certain file extensions
<FilesMatch "\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp|sh)$">
Require all denied

# Allow access to PHP files only within the application directories
<FilesMatch "\.php$">
<If "-f %{REQUEST_FILENAME}">
Require all granted

<If "-d %{REQUEST_FILENAME}">
Require all denied

# Deny access to sensitive directories

IndexIgnore *

# Enable Deflate compression for specified type

AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.

AddHandler application/x-httpd-ea-php82 .php .php8 .phtml

# php -- END cPanel-generated handler, do not edit

Additional Tips

Hope this helps people that use Softaculous. BTW, I installed a new Softaculous version of Mautic and then moved all the content (step 4), which makes this extremely quick and easy. If you have any issues, let me know.

If you are in doubt, clone your Mautic installation. The hardest part is the DB part, especially if it's big. You can do it with MySQL line commands, but it can be easy using "bigdump": BigDump GitHub

This file inserts in small chunks big databases. It's like it cuts the SQL insert statements into small pieces, so the process won't crash.

Settings for BigDump:

// OPTIONAL SETTINGS

$filename = 'brandvw_mautbvw.sql'; // Specify the dump filename to suppress the file selection dialog
$ajax = true; // AJAX mode: import will be done without refreshing the website
$linespersession = 1000; // Lines to be executed per one import session
$delaypersession = 100; // You can specify a sleep time in milliseconds after each session
// Works only if JavaScript is activated. Use to reduce server overrun

Max Query Lines:

// How many lines may be considered to be one query (except text lines)
$max_query_lines = 10000;

Then update this version and test it.

Update from Mautic 4 to 5.1 when installed by softaculous (Quick Guide)
  • COMMENT

  • Powered by PHPKB (Knowledge Base Software)