# CRITICAL: Uncaught PHP Exception. Trying to send email in 4.0.2

**URL:** <https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754>\
**Category:** Product Support\
**Created:** [November 24, 2021, 2:06pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754 "2021-11-24T14:06:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fkrafft](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/fkrafft/32/2220_2.png) [@fkrafft](https://forum.mautic.org/u/fkrafft)\
**Post date:** [November 24, 2021, 2:06pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754/1 "2021-11-24T14:06:11Z")

</div>

**Your software**  
_My PHP version is_ : 7.4.26  
_My MariaDB version is_: 10.3.31-MariaDB-0ubuntu0.20.04.1

_These errors are showing in the Mautic log_ :  
mautic.NOTICE: Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘INSERT INTO email\_stats  
(email\_address, date\_sent, is\_read, is\_failed, viewed\_in\_browser, date\_read, tracking\_hash, retry\_count, source, source\_id, tokens, open\_count, last\_opened, open\_details, email\_id, lead\_id, list\_id, ip\_id, copy\_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [MY PARAMETERS]:  
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine (uncaught exception) at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 while running console command `mautic:broadcasts:send`

mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DriverException: “An exception occurred while executing ‘INSERT INTO email\_stats (email\_address, date\_sent, is\_read, is\_failed, viewed\_in\_browser, date\_read, tracking\_hash, retry\_count, source, source\_id, tokens, open\_count, last\_opened, open\_details, email\_id, lead\_id, list\_id, ip\_id, copy\_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [MY PARAMETERS]:  
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine” at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 128 {“exception”:"[object] (Doctrine\DBAL\Exception\DriverException(code: 0): An exception occurred while executing ‘INSERT INTO email\_stats (email\_address, date\_sent, is\_read, is\_failed, viewed\_in\_browser, date\_read, tracking\_hash, retry\_count, source, source\_id, tokens, open\_count, last\_opened, open\_details, email\_id, lead\_id, list\_id, ip\_id, copy\_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)’ with params [MY PARAMETERS]:  
\n\n  
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:128, Doctrine\DBAL\Driver\PDO\Exception(code: HY000):  
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: HY000):  
SQLSTATE[HY000]: General error: 1467 Failed to read auto-increment value from storage engine at /var/www/html/mautic4/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)"}

**Your problem**  
_My problem is_ :  
When I send an email as a segment email, I get the error message " Uh oh! I think I broke it…"

The issue could be related to that did run a package update.  
sudo apt get update  
sudo apt get upgrade

Did see a notification about FPM, and I did check the status of FPM, it says enabled.  
FYI, the active Server API according to the PHP Status is Apache 2.0 Handler.  
The status check show that FPM is active.  
Is FPM optional?

See notes from apt upgrade:

```auto
NOTICE: Not enabling PHP 7.4 FPM by default.
NOTICE: To enable PHP 7.4 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.4-fpm

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/3c8325c1a253b26d2f40324c7582943eb0fe123b.png)

_Steps I have tried to fix the problem_ :  
I made sure the permissions were set correctly

```auto
sudo find . -type f -not -perm 644 -exec chmod 644 {} +
sudo find . -type d -not -perm 644 -exec chmod 755 {} +
sudo chmod -R g+w var/cache/ var/logs/ app/config/
sudo chmod -R g+w media/files/ media/images/ translations/

```

I made sure ownership was set correctly

```auto
sudo chown -R www-data:www-data . 

```

I cleared the cache

```auto
sudo rm -rf var/cache/*

```

---

<div class="post-metadata">

**Author:** ![fkrafft](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/fkrafft/32/2220_2.png) [@fkrafft](https://forum.mautic.org/u/fkrafft)\
**Post date:** [November 24, 2021, 5:08pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754/2 "2021-11-24T17:08:14Z")

</div>

Update:  
Suddenly it did manage to send an email on 1 of 2 identical installations.  
But on the one that I did manage to send an email on, the log now started showing a lot of click errors like this one:

mautic.ERROR: Invalid clickthrough value:  
Yjo4OntmOjk6ImZiaGVkZiI7Yjo1Ont2OjM7Zjo4OiJmemJ2eSI7djo0O3Y6Nzc7fWY6ODoiZnpidnkiO3Y6Nzc7Zjo3OiJmZ2JnIjtmOjU1OiI5NDJmN2E0NDk3MzIwNjMyNjEzNDM1IjtmOjc6InlmYmUiO2Y6NToiNTMiO2Y6MDoiZHViYWFmeSI7Yjo0OntmOjg6ImZ6YnZ5Ijt2Ojc3O319 {“exception”:"[object] (Mautic\CoreBundle\Exception\InvalidDecodedStringException(code: 0): The string b:8:{f:9:“fbhedf”;b:5:{v:3;f:8:“fzbvy”;v:4;v:77;}f:8:“fzbvy”;v:77;f:7:“fgbg”;f:55:“942f7a4497320632613435”;f:7:“yfbe”;f:5:“53”;f:0:“dubaafy”;b:4:{f:8:“fzbvy”;v:77;}} is not a serialized array at /var/www/html/mautic4/app/bundles/CoreBundle/Helper/ClickthroughHelper.php:46)"}

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [January 5, 2022, 11:51am UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754/3 "2022-01-05T11:51:42Z")

</div>

Hi,  
This is probably happening to you, because you updated your PHP / Mysql in the background but forgot to restart them.  
Once it’s been restarted, it started to work for you.  
Regarding the clicks - no idea.

---

<div class="post-metadata">

**Author:** ![mrfromgermany](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mrfromgermany/32/433_2.png) [@mrfromgermany](https://forum.mautic.org/u/mrfromgermany)\
**Post date:** [February 14, 2022, 9:02pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754/4 "2022-02-14T21:02:25Z")

</div>

Hi, i had the same error message “General error: 1467 Failed to read auto-increment value from storage engine …”. In my case with this error i was not able to create new contacts.

I was able to fix the problem with following mysql-command:

```auto
ALTER TABLE`leads`AUTO_INCREMENT =1;

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [May 15, 2023, 5:19pm UTC](https://forum.mautic.org/t/critical-uncaught-php-exception-trying-to-send-email-in-4-0-2/21754/5 "2023-05-15T17:19:02Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
