Mautic 3 - Pretty Fresh Install - Won't run bin/console commands

Your software Digital Ocean Droplet Apache2/ubuntu 20.04
My PHP version is : 7.3
My MySQL/MariaDB version is (delete as applicable): MariaDB version 5.7

Updating/Installing Errors
I am (delete as applicable): Updating
Upgrading/installing via (delete as applicable) : Command Line

These errors are showing in the installer :

When I tried to install the update:
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/html/vendor/composer/autoload_static.php on line 4461

After I Installed the update (through web) and tried to run bin/console commands:

In AbstractMySQLDriver.php line 106: 
An exception occurred in driver: could not find driver

In PDOConnection.php line 31:
could not find driver

In PDOConnection.php line 27:
could not find driver

 // Clearing the cache for the prod environment with debug false                                                        

In XmlUtils.php line 50:
  Extension DOM is required.  

These errors are showing in the Mautic log (one of the errors others are also about DriverExceptionAbstractMySQLDriver.php) :

mautic.NOTICE: Doctrine\DBAL\Exception\DriverException: An exception occurred in driver: could not find driver (uncaught exception) at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 106 while running console command `mautic:campaigns:rebuild` [] []
[2020-12-13 16:36:01] mautic.WARNING: Command `mautic:campaigns:rebuild` exited with status code 1 [] []

These errors are showing in the upgrade_log.txt file (located in the root of your Mautic instance when an upgrade has been attempted - ensure you remove or redact any sensitive data such as domain names in the file path) :

No upgrade-log.txt

Your problem
My problem is :

Can’t execute commands without an error from console

Steps I have tried to fix the problem :

Hi and thank you for mautic. I am pretty new to unix and so might have overlooked something but I do try and google/forum hard in search for an answer

It’s a fresh install

Initially I run into

PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in /var/www/html/vendor/composer/autoload_static.php on line 4461

Even though I had setup the apache2/php.ini to 512MB before mautic was installed I changed it to 1024MB just to be safe, and I also changed the php.ini for the php7.3/cli for whatever reason. I also saw some recommendations for maximum_execution_time = 600 to be greater than 240 which was also modified.

I could only clean my cache manually with rm -R /var/cache/* and I did that at every opportunity.

Alas, It did not make any difference.

I then managed to upgrade from 3.1.2 -> 3.2. via the web environment, thats when I assumed the error disappeared. When I tried to run some commands ( cron wasn’t working) I realised the PHP fatal error was still there. Again I cleaned the cache with rm -R /var/cache/* but this time got the new set of errors about drivers (shown above) after reboot. I also installed composer globally and then tried to composer install in the mautic root folder (suggested in one of the threads) but then it didn’t execute obviously cause I don’t know how the composer works. So I yeah I am kind stuck. Nothing…

I am just thinking it be quicker to reinstall on a fresh droplet

The commands are executed directly from php so you need to update params of memory in /etc/php7.3/php.ini , apache2/php.ini only affect to php that execute inside apache2 environment.

The driver you need to isntall it’s mysql PDO you can use “sudo apt-get install php-mysql” or sudo apt-get install php7.3-mysql



Thanks for your suggestions, yeah I mentioned I’ve done all that.

Anyway, my friend an I figured out what it was, somehow some components of php7.4 were installed and that was causing all the problems above. I don’t know how that happened under the radar. After I purged the all versions of php and reinstalled it worked. I had to reapply a2enmod rewrite ,permissions again as the php pages werent accessible past the login screen.