502 – Bad Gateway
-
I installed the Matomo wordpress plugin on sentispec.com some time ago. During initial installation/configuration I got a series of 502 Bad Gateway errors. I was unable to trace the exact cause at the time and, since the error did not reoccur, I simply ignored the problem. But, today, the problem came back and, with the help of Siteground support services, it looks like we might have narrowed the problem down to a matomo function that’s looking for mysqli: The cause for the issue was that the site had hit the processes limit of 80 simultaneous processes and there were a significant number of processes identified like these examples below: 9605 u1293-wqoutvsudjf5 grep grep mysqli and 21059 u1293-wqoutvsudjf5 grep grep mysqli These seem to have originated from the following function: [email protected]:~/www/sentispec.com/public_html$ grep -i “grep mysqli” wp-content/plugins/matomo/classes/WpMatomo/Admin/SystemReport.php
switch ( $this->get_phpcli_output( ‘-m | grep mysqli’ ) ) { Inspection of the public_html shows no sign of mysqli - is this the problem ?? If so, how should I go about rectifying the problem ? Will removing and re-installing the matomo plugin be the simplest way forward - or will I risk loosing matomo data in the process ?? MikeThe page I need help with: [log in to see the link]
-
Hello @mikepfive For us to investigate this further, can you please send us a copy of your system check report which you can get by following this guide.
Hi @mikepfive . Have you had a chance to look at my previous comment or maybe any question around this?
Hi,
Thanks for this.
Sorry not to get back to you sooner – ( I’ve been on holiday for a week or so, and only got back yesterday!! )
I checked out the guide on how to generate a system report and added ‘MATOMO_SAFE_MODE’ to the wp-config.php file on the live site – but I’m nervous about activating the Matomo plugin ( its currently disabled ) on a live site. I’d hate to get a 502 again as I’m not 100% about how to recover from this error and might need assistance from Siteground admin support. If there’s little/no risk then great – otherwise I’ll arrange for Siteground admin support to be on standby so that downtime can be minimised. Let me have your thoughts…
Best Regards, Mike
Hello @mikepfive I would recommend to activate the plugin on the time while getting less visitor. Probably in the evening. This way, you can have access to the system report.
If you activated the Matomo plugin and still can’t get the system check report, please send us a copy of php error log. There probably will be something in there that will help us identify the issue.
Once you’ll able to get the information, you can deactivate the plugin again, to keep your live site working.
Thanks for getting back to me
The Site is pretty quite today so having previously enabled ‘MATOMO_SAFE_MODE’ via the wp-config.php file on the live site I activated the Matomo plugin without any problems.
The only option visible via the matomo menu was to generate system report but – when I selected this option – the following error message was created:
Fatal error: Uncaught Error: Class ‘Piwik\Plugins\SitesManager\Model’ not found in /home/customer/www/sentispec.com/public_html/wp-content/plugins/matomo/classes/WpMatomo/Admin/SystemReport.php:997 Stack trace: #0 /home/customer/www/sentispec.com/public_html/wp-content/plugins/matomo/classes/WpMatomo/Admin/SystemReport.php(252): WpMatomo\Admin\SystemReport->get_wordpress_info() #1 /home/customer/www/sentispec.com/public_html/wp-content/plugins/matomo/classes/WpMatomo/Admin/SystemReport.php(322): WpMatomo\Admin\SystemReport->get_error_tables() #2 /home/customer/www/sentispec.com/public_html/wp-includes/class-wp-hook.php(308): WpMatomo\Admin\SystemReport->show(”) #3 /home/customer/www/sentispec.com/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(”, Array) #4 /home/customer/www/sentispec.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /home/customer/www/sentispec.com/public_html/wp-admin/admin.php(259): do_action(‘matomo-analytic…’) #6 {main} thrown in /home/customer/www/sentispec.com/public_html/wp-content/plugins/matomo/classes/WpMatomo/Admin/SystemReport.php on line 997
There has been a critical error on this website. Please check your site admin email inbox for instructions.Learn more about troubleshooting WordPress.
—
No email has (yet) been received from the site, and there’s no (relevant) message in the Siteground Error log – but (hopefully!) the above message will be able to help in establishing the cause of the problems here?
Please let me know If you’d like me to do anything further here.
Best Regards, Mike
Hi @mikepfive this issue is generally caused by missing files in your?directory. To fix this issue, please try to uninstall the Matomo plugin and reinstall.
If after re-installing the new one and you still experience this issue, try to restart the web server if possible.
If you still have the issue after doing those two steps, please share to us the list of plugins you have installed in your WordPress so we can check if there is incompatibility issues.
Hi,
I waited until the weekend to carry out the reinstallation you’ve suggested
I removed the existing plugin, reinstalled the plugin and removed set the MATOMO_SAFE_MODE option to false.
Not a particularly pleasant experience, and several error messages on the way.
Notice: An unexpected error occurred. Something may be wrong with www.remarpro.com or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to www.remarpro.com. Please contact your server administrator.) in /home/customer/www/sentispec.com/public_html/wp-includes/update.php on line 447
Warning: Cannot modify header information – headers already sent by (output started at /home/customer/www/sentispec.com/public_html/wp-includes/update.php:447) in /home/customer/www/sentispec.com/public_html/wp-admin/admin-header.php on line 9
I noticed that the Siteground Optimiser was generating an ‘Error x’ message (no details presented by the plugin – just the word Error ) so I disabled this plugin, which removed the error messages above. I then re-enabled Siteground Optimiser, without a problem, and it now seems like the site is working OK
Along the way I’ve been able to create and copy the Matomo Diagnostics report below.
I’m unsure why the PHP cli Version is incompatible – or why MySQLi support is missing. [ I am running PHP 7.4.33 and unfamiliar with how to configure PHP to run with specific requirements and Siteground PHP configuration options appear not to mention either ‘cli’ or ‘MySQLi’ ]
Errors
- Error PHP cli Version: (Your PHP cli version is not compatible with the Matomo requirements. Please upgrade your PHP cli version, otherwise, you might have some archiving errors)
- Error MySQLi support: missing (Your PHP cli does not load the MySQLi extension. You might have archiving problems in Matomo but also others problems in your WordPress cron tasks. You should enable this extension)
Matomo
- Matomo Plugin Version: 4.14.2
- Config exists and is writable.: Yes (“$abs_path/wp-content/uploads/matomo/config/config.ini.php” )
- JS Tracker exists and is writable.: Yes (“$abs_path/wp-content/uploads/matomo/matomo.js” )
- Plugin directories: Yes ([{“pluginsPathAbsolute”:”$abs_path\/wp-content\/plugins\/matomo\/plugins”,”webrootDirRelativeToMatomo”:”..\/”}])
- Tmp directory writable: Yes ($abs_path/wp-content/cache/matomo)
- Matomo Version: 4.14.2
- Matomo Blog idSite: 1
- Matomo Install Version: 4.14.2 (Install date: 2023-05-13 07:15:42)
- Upgrades outstanding: No
- Upgrade in progress: No
Endpoints
- Matomo JavaScript Tracker URL: ($site_url/wp-content/uploads/matomo/matomo.js)
- Matomo JavaScript Tracker – WP Rest API: ($site_url/wp-json/matomo/v1/hit/)
- Matomo HTTP Tracking API: ($site_url/wp-content/plugins/matomo/app/matomo.php)
- Matomo HTTP Tracking API – WP Rest API: ($site_url/wp-json/matomo/v1/hit/)
Crons
- Server time: 2023-05-13 07:46:50
- Blog time: 2023-05-13 07:46:50 (Below dates are shown in blog timezone)
- Sync users & sites: Next run: 2023-05-14 07:46:33 (23 hours 59 min) ( Last started: 2023-05-13 07:46:43 (-7s). Last ended: 2023-05-13 07:46:44 (-6s). Interval: daily)
- Archive: Next run: 2023-05-13 08:46:33 (59 min 43s) ( Last started: 2023-05-13 07:46:44 (-6s). Last ended: 2023-05-13 07:16:00 (-30 min 50s). Interval: hourly)
- Update GeoIP DB: Next run: 2023-05-13 07:46:33 (-17s) ( Last started: 2023-05-13 07:22:58 (-23 min 52s). Last ended: 2023-05-13 07:22:59 (-23 min 51s). Interval: matomo_monthly)
Mandatory checks
- PHP version >= 7.2.5: ok
- PDO extension: ok
- PDO\MYSQL extension: ok
- MYSQLI extension: ok
- Other required extensions: ok
- Required functions: ok
- Required PHP configuration (php.ini): ok
- Directories with write access: ok
- Directories with write access for Tag Manager: ok
Optional checks
- 64-bit PHP Binary: ok
- Tracker status: ok
- Memory limit: ok
- Time zone: ok
- Open URL: ok
- GD > 2.x + FreeType (graphics): ok
- Other extensions: ok
- Other functions: ok
- Filesystem: ok
- Last Successful Archiving Completion: ok
- Database abilities: ok
- Warning Max Packet Size: warning (It is recommended to configure a ‘max_allowed_packet’ size in your MySQL database of at least 64MB. Configured is currently 32MB. )
- Geolocation: ok
- Update over HTTPS: ok
- Supports Async Archiving: No
- Location provider ID: geoip2php
- Location provider available: Yes
- Location provider working: Yes
- Warning Proxy header: HTTP_X_REAL_IP (A proxy header is set which means you maybe need to configure a proxy header in the Advanced settings to make location reporting work. If the location in your reports is detected correctly, you can ignore this warning. Learn more)
- Had visit in last 5 days: Yes
- Matomo URL: Yes ($site_url/wp-content/plugins/matomo/app/)
Matomo Settings
- Track mode: default
- Track codeposition: footer
- Track api endpoint: default
- Track js endpoint: default
- Version history: 4.14.2
- Core version: 4.14.2
- Last tracking settings update: 1683962578
- Last settings update: 1683962578
Logs
- update_geoip2: 2023-05-13 07:18:38 (GeoIP2AutoUpdater: failed to download ‘https://download.db-ip.com/free/dbip-city-lite-2023-05.mmdb.gz’ to ‘$abs_path/wp-content/cache/matomo/latest/DBIP-City.mmdb.gz.download’: Error while fetching data: cURL error 6: getaddrinfo() thread failed to start => GeoIP2AutoUpdater.php:176; GeoIP2AutoUpdater.php:106; ScheduledTasks.php:238; class-wp-hook.php:306; class-wp-hook.php:332; plugin.php:565; wp-cron.php:188;)
WordPress
- Home URL: $site_url
- Site URL: $site_url
- WordPress Version: 6.2
- Number of blogs: 1
- Multisite Enabled: No
- Network Enabled: No
- WP_DEBUG: No
- WP_DEBUG_DISPLAY: Yes
- WP_DEBUG_LOG: No
- DISABLE_WP_CRON: –
- FORCE_SSL_ADMIN: Yes
- WP_CACHE: No
- CONCATENATE_SCRIPTS: –
- COMPRESS_SCRIPTS: –
- COMPRESS_CSS: –
- ENFORCE_GZIP: –
- WP_LOCAL_DEV: –
- WP_CONTENT_URL: $site_url/wp-content
- WP_CONTENT_DIR: $abs_path/wp-content
- UPLOADS: –
- BLOGUPLOADDIR: –
- DIEONDBERROR: –
- WPLANG: –
- ALTERNATE_WP_CRON: –
- WP_CRON_LOCK_TIMEOUT: 60
- WP_DISABLE_FATAL_ERROR_HANDLER: –
- MATOMO_SUPPORT_ASYNC_ARCHIVING: –
- MATOMO_TRIGGER_BROWSER_ARCHIVING: –
- MATOMO_ENABLE_TAG_MANAGER: –
- MATOMO_SUPPRESS_DB_ERRORS: –
- MATOMO_ENABLE_AUTO_UPGRADE: –
- MATOMO_DEBUG: –
- MATOMO_SAFE_MODE: No
- MATOMO_GLOBAL_UPLOAD_DIR: –
- MATOMO_LOGIN_REDIRECT: –
- Permalink Structure: /%category%/%postname%/
- Possibly uses symlink: No
- Upload base url: $site_url/wp-content/uploads
- Upload base dir: $abs_path/wp-content/uploads
- Upload url: $site_url/wp-content/uploads/2023/05
- Custom upload_path: No
- Custom upload_url_path: No
- Compatible content directory: Yes
WordPress Plugins
MU Plugins
- InfiniteWP – Client Loader: 1.0.1
Plugins
- Better Search Replace: 1.4.2 (Network enabled)
- Blocksy Companion (Premium): 1.8.86
- Check & Log Email: 1.0.7
- Code Snippets: 3.3.0
- Contact Form 7: 5.7.6
- Flamingo: 2.3
- Flexible Table Block: 2.9.1
- InfiniteWP – Client: 1.11.1 (Network enabled)
- Koko Analytics: 1.0.38
- Matomo Analytics – Ethical Stats. Powerful Insights.: 4.14.2
- Rank Math SEO: 1.0.114
- Redirection: 5.3.10
- Simple Custom CSS and JS: 3.43
- Simple History: 3.5.1
- SiteGround Central: 3.0.0
- SiteGround Optimizer: 7.3.1
- SiteGround Security: 1.4.5
- SSL Insecure Content Fixer: 2.7.2
- Stackable – Gutenberg Blocks: 3.7.2
- Stackable – Gutenberg Blocks (Premium): 3.7.2
- Wordfence Security: 7.9.2 (Network enabled)
- WP Mail SMTP: 3.8.0
- Yoast Duplicate Post: 4.5
- Active Plugins: 20 (iwp-client koko-analytics better-search-replace blocksy-companion-pro code-snippets contact-form-7 custom-css-js duplicate-post flamingo flexible-table-block matomo redirection seo-by-rank-math sg-security simple-history ssl-insecure-content-fixer stackable-ultimate-gutenberg-blocks-premium wordfence wordpress-starter wp-mail-smtp)
- Theme: blocksy (blocksy-child)
Server
- Server Info: Apache
- Apache AddHandler support: Supported
- PHP OS: Linux
- PHP Version: 7.4.33
- PHP SAPI: apache2handler
- PHP Maxmind DB extension: Not loaded
- PHP Error Reporting: After bootstrap: 0
- Timezone: UTC
- WP timezone: +00:00
- Locale: en_US
- User Locale: en_US
- Memory Limit: 768M (At least 128MB recommended. Depending on your traffic 256MB or more may be needed.)
- WP Memory Limit: 256M
- WP Max Memory Limit: 768M
- Timezone version: 2022.1
- Time: 1683964011
- Max Execution Time: 120
- Max Post Size: 256M
- Max Upload Size: 268435456
- Max Input Vars: 3000
- Disabled PHP functions: No
- zlib.output_compression is off: Yes
- Curl Version: 7.85.0, OpenSSL/3.0.8
- Suhosin installed: No
PHP cli
- Error PHP cli Version: (Your PHP cli version is not compatible with the Matomo requirements. Please upgrade your PHP cli version, otherwise, you might have some archiving errors)
- Error MySQLi support: missing (Your PHP cli does not load the MySQLi extension. You might have archiving problems in Matomo but also others problems in your WordPress cron tasks. You should enable this extension)
Database
- MySQL Version: 5.7.39
- Mysqli Connect: Yes
- Force MySQL over Mysqli: No
- DB Prefix: myd_
- DB CHARSET: utf8
- DB COLLATE:
- SHOW ERRORS: No
- SUPPRESS ERRORS: No
- Uses Socket: No
- Uses IPv6: No
- Matomo tables found: 38
- DB tables exist: Yes
- Matomo users found: 5
- Matomo sites found: 1
- Required permissions: OK
Browser
- Browser: (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36)
- Language: en-gb,en,en-us
Hi @mikepfive to fix this, please address the Error PHP cli Version.
There are two ways to solve this problem:
- force the php cli path in the Matomo configuration which you can check on this guide https://github.com/matomo-org/matomo-for-wordpress/issues/647#issuecomment-1409284712
- disable the async mode which let php CLI calls unavailable by editing you?
wp-config.php
?and adding the following line:define( 'MATOMO_SUPPORT_ASYNC_ARCHIVING', false );
Hi @mikepfive I hope you’re doing well. I just want to ask if the previous troubleshooting steps I provided fixed the issue?
Hi,
Sorry not to get back to you sooner.
I’ve been busy on other projects and only just had time to get back to this issue
In the meantime, Matomo appears to be working without a hitch.
So, today, I added the following line to wp-config.php:
define( ‘MATOMO_SUPPORT_ASYNC_ARCHIVING’, false );
But when I run Matomo diagnostics I still get warnings about?PHP cli Version &?MySQLi support: missing
Mike
Hi again @mikepfive kindly try the troubleshooting steps on this guide as it might fix the issue: https://matomo.org/faq/how-to-solve-the-error-message-your-php-cli-version-is-not-compatible-with-the-matomo-requirements/
Hey @mikepfive . Have you already had a look at our last comment or maybe any question about it?
Hi?@mikepfive As we didn’t receive a response after 1 week, we’re marking this issue as resolved. If something is not working, feel free to leave a comment and we’d be happy to assist.
- The topic ‘502 – Bad Gateway’ is closed to new replies.