Getting a file_get_contents and Curl not activated error

I just installed the Modern Events calendar plugin and I’m getting this error:
"file_get_contents" and “Curl” functions are not activated on your server. Please contact your host provider in this regard.

Are those services turned on in Local Lightning?

1 Like

Hey @mikemuller

That’s definitely odd – and Local should be shipping with that php extension.

If you right click on the site and select “Open site shell”, do you see curl in the output when issuing this command:

php -m

If you don’t see curl, then maybe there’s an odd issue with the PHP service.

If that’s the case, can you try updating the service by following the steps in this community forum thread with more info along with a fix:

Using the instructions in the above link, can you try re-downloading the PHP services and try again?

curl is listed when running php -m. Any suggestions? I assume the get_file_contents is part of curl?

Hey @mikemuller – It’s hard to know how that plugin is coming to it’s conclusion that those functions aren’t working and it might be worthwhile to reach out to the plugin developer to get more info.

For background info, the file_get_contents() function is built into PHP and is used to read a file as a string into a variable:

Given that the plugin is also mentioning curl – that makes me think that they are trying to retrieve some sort of remote file. Either way, it’s probably a good idea to reach out to the plugin devs to see what they are trying to do and verify that things are actually breaking within Local.

They are trying to pull a remote .json file. I reached out to them and they said it was a server issue. If I put this up on a server it works properly but not with Local. Must be some sort of block because I’m working locally.

Here is the error Log:

[06-Aug-2020 20:27:44 UTC] PHP Warning:  get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php on line 87
[06-Aug-2020 20:27:44 UTC] PHP Stack trace:
[06-Aug-2020 20:27:44 UTC] PHP   1. {main}() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:0
[06-Aug-2020 20:27:44 UTC] PHP   2. do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:254
[06-Aug-2020 20:27:44 UTC] PHP   3. WP_Hook->do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/plugin.php:478
[06-Aug-2020 20:27:44 UTC] PHP   4. WP_Hook->apply_filters() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:311
[06-Aug-2020 20:27:44 UTC] PHP   5. MEC_feature_mec->addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:287
[06-Aug-2020 20:27:44 UTC] PHP   6. MEC_feature_mec->display_addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:710
[06-Aug-2020 20:27:44 UTC] PHP   7. include() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:722
[06-Aug-2020 20:27:44 UTC] PHP   8. MEC_envato->get_MEC_info() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php:11
[06-Aug-2020 20:27:44 UTC] PHP   9. MEC_envato::get_api_url() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php:316
[06-Aug-2020 20:27:44 UTC] PHP  10. get_headers() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php:87
[06-Aug-2020 20:27:44 UTC] PHP Warning:  get_headers(): Failed to enable crypto in /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php on line 87
[06-Aug-2020 20:27:44 UTC] PHP Stack trace:
[06-Aug-2020 20:27:44 UTC] PHP   1. {main}() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:0
[06-Aug-2020 20:27:44 UTC] PHP   2. do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:254
[06-Aug-2020 20:27:44 UTC] PHP   3. WP_Hook->do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/plugin.php:478
[06-Aug-2020 20:27:44 UTC] PHP   4. WP_Hook->apply_filters() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:311
[06-Aug-2020 20:27:44 UTC] PHP   5. MEC_feature_mec->addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:287
[06-Aug-2020 20:27:44 UTC] PHP   6. MEC_feature_mec->display_addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:710
[06-Aug-2020 20:27:44 UTC] PHP   7. include() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:722
[06-Aug-2020 20:27:44 UTC] PHP   8. MEC_envato->get_MEC_info() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php:11
[06-Aug-2020 20:27:44 UTC] PHP   9. MEC_envato::get_api_url() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php:316
[06-Aug-2020 20:27:44 UTC] PHP  10. get_headers() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php:87
[06-Aug-2020 20:27:44 UTC] PHP Warning:  get_headers(https://webnus.biz): failed to open stream: operation failed in /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php on line 87
[06-Aug-2020 20:27:44 UTC] PHP Stack trace:
[06-Aug-2020 20:27:44 UTC] PHP   1. {main}() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:0
[06-Aug-2020 20:27:44 UTC] PHP   2. do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:254
[06-Aug-2020 20:27:44 UTC] PHP   3. WP_Hook->do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/plugin.php:478
[06-Aug-2020 20:27:44 UTC] PHP   4. WP_Hook->apply_filters() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:311
[06-Aug-2020 20:27:44 UTC] PHP   5. MEC_feature_mec->addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:287
[06-Aug-2020 20:27:44 UTC] PHP   6. MEC_feature_mec->display_addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:710
[06-Aug-2020 20:27:44 UTC] PHP   7. include() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:722
[06-Aug-2020 20:27:44 UTC] PHP   8. MEC_envato->get_MEC_info() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php:11
[06-Aug-2020 20:27:44 UTC] PHP   9. MEC_envato::get_api_url() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php:316
[06-Aug-2020 20:27:44 UTC] PHP  10. get_headers() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/libraries/envato.php:87
[06-Aug-2020 20:27:44 UTC] PHP Warning:  file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php on line 39
[06-Aug-2020 20:27:44 UTC] PHP Stack trace:
[06-Aug-2020 20:27:44 UTC] PHP   1. {main}() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:0
[06-Aug-2020 20:27:44 UTC] PHP   2. do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:254
[06-Aug-2020 20:27:44 UTC] PHP   3. WP_Hook->do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/plugin.php:478
[06-Aug-2020 20:27:44 UTC] PHP   4. WP_Hook->apply_filters() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:311
[06-Aug-2020 20:27:44 UTC] PHP   5. MEC_feature_mec->addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:287
[06-Aug-2020 20:27:44 UTC] PHP   6. MEC_feature_mec->display_addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:710
[06-Aug-2020 20:27:44 UTC] PHP   7. include() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:722
[06-Aug-2020 20:27:44 UTC] PHP   8. file_get_contents() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php:39
[06-Aug-2020 20:27:44 UTC] PHP Warning:  file_get_contents(): Failed to enable crypto in /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php on line 39
[06-Aug-2020 20:27:44 UTC] PHP Stack trace:
[06-Aug-2020 20:27:44 UTC] PHP   1. {main}() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:0
[06-Aug-2020 20:27:44 UTC] PHP   2. do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:254
[06-Aug-2020 20:27:44 UTC] PHP   3. WP_Hook->do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/plugin.php:478
[06-Aug-2020 20:27:44 UTC] PHP   4. WP_Hook->apply_filters() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:311
[06-Aug-2020 20:27:44 UTC] PHP   5. MEC_feature_mec->addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:287
[06-Aug-2020 20:27:44 UTC] PHP   6. MEC_feature_mec->display_addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:710
[06-Aug-2020 20:27:44 UTC] PHP   7. include() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:722
[06-Aug-2020 20:27:44 UTC] PHP   8. file_get_contents() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php:39
[06-Aug-2020 20:27:44 UTC] PHP Warning:  file_get_contents(https://webnus.net/modern-events-calendar/addons-api/addons-api.json): failed to open stream: operation failed in /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php on line 39
[06-Aug-2020 20:27:44 UTC] PHP Stack trace:
[06-Aug-2020 20:27:44 UTC] PHP   1. {main}() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:0
[06-Aug-2020 20:27:44 UTC] PHP   2. do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-admin/admin.php:254
[06-Aug-2020 20:27:44 UTC] PHP   3. WP_Hook->do_action() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/plugin.php:478
[06-Aug-2020 20:27:44 UTC] PHP   4. WP_Hook->apply_filters() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:311
[06-Aug-2020 20:27:44 UTC] PHP   5. MEC_feature_mec->addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-includes/class-wp-hook.php:287
[06-Aug-2020 20:27:44 UTC] PHP   6. MEC_feature_mec->display_addons() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:710
[06-Aug-2020 20:27:44 UTC] PHP   7. include() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec.php:722
[06-Aug-2020 20:27:44 UTC] PHP   8. file_get_contents() /Users/mikemuller/Sites/fly-fishing-site/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php:39

Seems to be an SSL validation issue.

Nice! I think you’re reading of the error message is correct – it’s something preventing the WordPress site from making a secure connection over HTTPS.

From the log path separator, it looks like you are using macOS – what version is installed?

If you click on the “Trust” button within Local to register the SSL certificate with the computer, does that remove the error message and allow you to use those functions?

Hi Ben, I’m using 10.15.6. I do have the SSL trusted. Is there a way to re-trust the cert? Or there’s an issue with the SSL locally which doesn’t validate.

I also just did a test using Lando as a local environment and the SSL issue did not happen. Must be something with Local Lightning.

Thanks for mentioning that it’s working with Lando! Since Lando is built on Docker, that makes me think that there’s an issue with the OpenSSL certs that Local’s version of PHP is using.

As a test, I tried using the URL in the error message you provided and was able to connect to the API over HTTPS:

https://webnus.net/modern-events-calendar/addons-api/addons-api.json

Do you have any antivirus software installed? Since Local’s software is installed directly on the Host machine, it might be that there is something that is interfering with Local’s version of PHP. The reason that something like Lando would work in this case is that it’s a virtualized environment and so it wouldn’t be subject to security settings on the host machine.

I don’t have any anti-virus software installed. I was able to connect to that url as well.

If I provided the plugin, could you try on your end to see if it’s an issue with my computer or an issue with they way Local uses openSSL?

Sure @mikemuller – If you send me a DM, with the plugin attached I can take a look. Just so I know exactly where I’m looking – what’s the URL where you are seeing that original error message?

Just sent a message to you. Let me know if you did not get it.

Thanks for your patience with this @mikemuller – I tried various permutations of site setup:

  1. New site with “Site domains” router mode, over regular HTTP
  2. New site with “Site domains” router mode, over HTTPS
  3. New site with “localhost” router mode, over HTTP

In all those cases, I was able to access the “addon” page for that plugin in the WP admin. That makes me think that there’s something specific with that site, possibly a conflict with another plugin or the theme.

Can you try using that plugin on a new, plain WordPress site with the default theme? If that does work for you then I would recommend zeroing in on which plugins are causing issues by deactivating them and re-enabling them one-by-one.

I get the same error:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /Users/mikemuller/Sites/test/app/public/wp-content/plugins/modern-events-calendar/app/features/mec/addons.php on line 39

This is a fresh WP install with only this plugin. Must be something in the settings on my mac. Any ideas??

It could be some sort of setup with that Mac. Is this a work computer, for example, did the company implement any sort of security settings – I’m thinking of something like issuing their own SSL certificate or CA authority.

One other idea – How long have you had Local installed?

I wonder if maybe there’s an old version of the PHP service that needs to be updated? You could try first backing up your sites, and then the steps outlined in this reply, which deletes the current PHP service and downloads the latest ones:

I just installed a brand new virtual mac OS machine and a fresh copy of Local and am getting the same error. The install of MacOS is 10.15.5 which is Catalina. This version should not have any old versions of PHP.

What computer and OS are you using where it’s working?

I also checked the guide on refreshing the services and I’m not seeing 7.3.5 in that folder. Does that mean it’s loading from my core mac OS?

I’ve got the 13in Mac Pro, with 10.15.5 (19F101) installed.

I’m also using the latest version of Local – 5.6.10

What version of Local is installed?

Local won’t use any PHP other than the one that it ships with. Do you have a screenshot of the folder that you are looking in?

Here’s the screenshot