Mautic on Shared Hosting – It’s a bad idea.
Hey, Since, you are on my article, I assume you might already have planned to install Mautic on a Shared Host. Well Just to let you know- It is really a bad idea. But there can be situations where you need to be working on a shared host and do not want to own a VPS. Well, you are at the right place. In this article, I will guide you about a few things that you must know before going ahead and installing Mautic on your favorite Shared Host.
If you do not already know how to install Mautic on a shared host. Follow this article completely so I can guide you do it hassle free.
Assuming you already own a domain/subdomain name. The First Step is to go and prepare your Host where you will be installing Mautic. I will take the example of Hostinger.com here as I already have their hosting plan with me. If you do not yet have a hosting plan, I would suggest you go with Hostinger, they have been fair with me so far and I’ve 5 years hosting plan with them.
If you are not a fan of Hostinger, my next suggestion will be Namecheap because they are awesome when it comes to support, and their servers are pretty beefed up. This blog itself runs on Namecheap.
Download Mautic :
Alright, we are ready to get started now. Let us go ahead and prep our cPanel. We will go ahead and download Mautic to download Mautic 3.2.5 in one step you can click here or go to https://mautic.org/download. (You will need to submit your email and your role with the Organization before you can download from the official link)
Install Mautic on cPanel:
Now we have the Mautic software downloaded, lets upload it to our domain or subdomain. In my case, I am using a subdomain. You do not need to name the subdomain mautic.domain.com you can have something like mail.domain.com or em.domain.com or anything for that matter.
Once we go ahead and upload our software, it is time to unzip the software and ensure permissions on all the folders are intact. The folder permissions inside Mautic will always be 755 and the file permissions needs to be in 644. Once you have checked the permission. Its time to go ahead and create a database where Mautic will store the Data.
When it comes to Database, you can easily create one by opening your cPanel and following the wizard provided. Keep a note of the Database Name, Database username and Database Password.
Once we have created the Database, it is time to go ahead and open the URL in a browser. My case its em.biswajitpradhan.com. Once you click open you would see something like the below attached image.
You will need to then follow the wizard. You might come across some warnings like the below messages, the message itself is clear about what is missing on the installation. Follow accordingly. Once you have followed it, hit the refresh button. You should see the Warning/Error message gone. Kindly note if you are on a Shared Hosting plan.
There are high chances the warning for PHP Memory will stay. Hit next to go to the next step where it asks you about the Database the script should be using. Once you enter the Database name, Database Username and password, the script moves to the next step, where it asks you about the Email Credentials and whether you should be queuing your emails. Follow the steps as needed from the below screen recording. Once done You should be brought back to login page of Mautic, where you will need to enter your admin username and password to be able to login.
Once you have logged in, check the email configuration settings and then we will go by setting our cron jobs to ensure Mautic works as intended.
Please note here: Due to the nature of Shared hosting. Running continuous crons might not be permitted by your host and your host might limit you crons. You will need to ensure you give your application enough time for that matter. Crons cannot be set to continuously get executed every minute and so. Ensure you have enough time intervals placed in between your crons.
Setting up Crons with Shared hosting can be tricky but rest assured its not the case with Mautic. Setting up Crons is easy with Mautic. You will need to find the public html directory of your Mautic Installation. You will need to go to the below page.
Look for the below Directory
Once you have the path to the cache directory Everything else is a piece of cake. Follow the steps below to setup crons.
Go to Your cPanel and type in CRON. You should see the cronjob panel now.
You will need to setup correct Path and settings using the CRON panel on your CPANEL and set the frequency of the CRON Jobs. Once done you can hit save and then go back to your Mautic instance.
This is what it will look like:
Other Crons that you can install.
Here is a list of Cron Jobs you might need as per your need.
bin/console mautic:segments:updatebin/console mautic:campaigns:updatebin/console mautic:emails:sendbin/console mautic:email:fetchbin/console mautic:campaigns:triggerbin/console mautic:importbin/console mautic:broadcasts:sendbin/console mautic:integration:fetchleadsbin/console mautic:integration:synccontactsbin/console mautic:webhooks:processbin/console cache:clear
You now should be able to login to your console and send out emails. I would love to hear from you if you were successful in setting up Mautic with your shared hosting provider.