I can confirm that both exec() and dl() do not work on sites hosted on WP Engine servers.
Since the exec() example you posted is just firing up cURL, I suggest using the WordPress HTTP API or PHP: cURL in its place.
As for dl(), it has actually been deprecated and removed in PHP 5.3 and newer. WP Engine only runs PHP 5.3 and higher.
On top of that, there are security issues that can come from using dl() in web accessible code. The alternative laid out in this serverfault thread won’t work at WP Engine, unfortunately, as custom php.ini files are not permitted.
Hope this helps!
Hello,
Regarding code:
exec( 'nohup curl "' . $url . '" > /dev/null 2>&1 &' );
It belongs to XML Importer premium feature and is being run in very specific cases. The import process in XMLI is complex and uses WordPress HTTP API by default for doing requests. Note, server on importing data is doing HTTP requests to itself ( to upload property images on separate request ). But, in fact, this solution may not work on some servers. Among the possible reasons:
- Server doesn’t have DNS, and so it can’t figure out who “example.com” is, even though it is *itself*.
- Server administrators, in a misguided attempt at security, have blocked “loopback” requests, so it can’t actually make a call back to itself.
- Server is running something called “mod_security” or similar, which actively blocks the call due to brain-dead configuration.
- Something else.
When it happens, images for imported properties may not be uploaded. For this case, we XML Importer has option “Run system command cron instead of PHP cron. ( Attention, enable the option only if listings are not being published but added to Draft status. )”. This option disables WordPress HTTP requests and enables exec(), you mentioned about.
So, if you do not use XML Importer feature or option above is disabled you will not have any issues with it.
Some additional information:
The current issue is VERY similar to ALTERNATIVE_WP_CRON setting. Here is some related links for more details:
Regarding code:
dl()
The current function has never been used in WP-Property. Plugin contains some third-party libraries, like XML library, which can be found in
/third-party/XML
This library is being used for some specific cases and contains dl() function. But WP-Property does not use the method where the function is called. So you should not worry about it.
Regards.