# 500 internal server error email link when tracking link clicks or page visits in a campaign

**URL:** <https://forum.mautic.org/t/500-internal-server-error-email-link-when-tracking-link-clicks-or-page-visits-in-a-campaign/19081>\
**Category:** Product Support\
**Created:** [April 19, 2021, 5:10pm UTC](https://forum.mautic.org/t/500-internal-server-error-email-link-when-tracking-link-clicks-or-page-visits-in-a-campaign/19081 "2021-04-19T17:10:10Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![ClementBrian](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@ClementBrian](https://forum.mautic.org/u/ClementBrian)\
**Post date:** [April 20, 2021, 10:43pm UTC](https://forum.mautic.org/t/500-internal-server-error-email-link-when-tracking-link-clicks-or-page-visits-in-a-campaign/19081/6 "2021-04-20T22:43:35Z")

</div>

I have found a solution to fix the problem once and for all

1. Enable pdo\_mysql on cpanel or server

2. In app/config/local.php, at ‘db\_driver’ =\> ‘mysqli’ change it to ‘db\_driver’ =\> ‘pdo\_mysql’

3. Clear Cache by deleting the cache folder via the file manager

Did the above and links tracking visits and url clicks are opening fine without the 500 internal server error.

The error code below guided me. I had ignored it since it wasn’t triggered by my own activities. It would autogenerate itself and fill the entire error log as one error.

 ![Error log](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/8/89bf91fe76f950c815b4c69b7e14e147f6593433.png)

mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO maunfbd\_campaign\_lead\_event\_failed\_log( `log_id`, `date_added`, `reason`) SELECT id, :dateAdded as date\_added, :message as reason from maunfbd\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘:dateAdded as date\_added, :message as reason from maunfbd\_campaign\_lead\_event…’ at line 2

More resources on the same.

> [@An exception occurred while executing REPLACE INTO campaign\_lead\_event\_failed\_log](https://forum.mautic.org/t/an-exception-occurred-while-executing-replace-into-campaign-lead-event-failed-log/14479):
>
> Your software My Mautic version is: 2.16.2 My PHP version is: 7.3.18 Your problem My problem is: Running email fetches with command: console mautic:email:fetch in Terminal shows:: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':dateAdded as date\_added, :message as reason from campaign\_lead\_event\_log WHERE ’ at line 2 That only happened once, but similar errors started to appear in the Mautic Logs): Y…

> <https://github.com/mautic/mautic/pull/6574>
>
> \*\*Please be sure you are submitting this against the \_staging\_ branch.\*\*
> 
> \[//\]…: # ( Please answer the following questions: )
> 
> | Q | A
> | --- | ---
> | Bug fix? | Y
> | New feature? | N
> | Automated tests included? | N
> | Related user documentation PR URL | /
> | Related developer documentation PR URL | /
> | Issues addressed (#s or URLs) | \[slack message\](https://mautic.slack.com/archives/C02HU8BUT/p1536841497000100), https://github.com/mautic/mautic/issues/6509
> | BC breaks? | N
> | Deprecations? | N
> 
> \[//\]: # ( Note that all new features should have a related user and/or developer documentation PR in their respective repositories. )
> 
> \[//\]: # ( Required: )
> \#### Description:
> 
> There were this error reported several times:
> \`\`\`
> Doctrine\\DBAL\\Exception\\SyntaxErrorException: An exception occurred while executing 'REPLACE INTO mau8g\_campaign\_lead\_event\_failed\_log( \`log\_id\`, \`date\_added\`, \`reason\`) SELECT id, :dateAdded as date\_added, :message as reason from mau8g\_campaign\_lead\_event\_log WHERE is\_scheduled = 1 AND lead\_id = :contactId AND campaign\_id = :campaignId AND rotation = :rotation': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':dateAdded as date\_added, :message as reason from mau8g\_campaign\_lead\_event\_log ' at line 2 (uncaught exception) at /home/clientsiwanta/public\_html/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 90 while running console command \`mautic:segments:update\` \[\] \[\]
> \`\`\`
> I think it's because the \`message\` is MySql keyword and therefore I suggest to replace it with \`reason\`. My IDE is highlighting the \`message\` word as well:
> !\[screen shot 2018-09-13 at 15 23 26\](https://user-images.githubusercontent.com/1235442/45491074-136a9000-b769-11e8-91f2-008a83dadbd4.png)
> 
> 
> \[//\]: # ( As applicable: )
> \#### Steps to reproduce the bug:
> 1. Unknown.
> 
> \#### Steps to test this PR:
> 1. Code review should suffice.

---

_[View the full topic](https://forum.mautic.org/t/500-internal-server-error-email-link-when-tracking-link-clicks-or-page-visits-in-a-campaign/19081)._
