Support » Plugin: Unsplash WP » XAMPP issues (Windows)

  • hughc


    For people suffering from an issue when saving files, ie

    Unable to save image, check your server permissions.

    The error is the default one, and misleading for me under Windows. The issue for me was not the ability to write to the plugin’s tmp folder (tho I’m really not sure why a location inside the plugin’s folder was chosen- surely a folder inside /wp-content/uploads/ would be a better bet?).

    The problem was that CURL was unable to create a secure (https) connection to unsplash to retrieve the image, as, by default, the relevant certificates are not installed. Result – the tmp directory was full of zero byte attempted downloads, that CURL could not complete.

    The correct solution is to read up on configuring CURL for secure connections. The hack way is to remove the host & peer verifications for the curl call, ie line 245 of admin.php:

          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

    Nothing to be proud of, but works.

    • This topic was modified 6 years ago by hughc.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dcooney


    Thanks for this. I’ll merge this update into the next version of this plugin.

    Care to explain what your issue with the /tmp directory?
    The file is saved here for 1 second, then deleted.


    Thread Starter hughc


    I have to stress that, as a fix, it’s pretty nasty hack, as https & peer verification are used for a reason, and disabling it is regarded as a Very Bad Idea, as it leaves you open to MITM attacks etc, but given the small scope here, I guess it’s OK.

    I guess my main issue with the choice of tmp directory location it is that, if WordPress is operating in an environment with limited permissions for the web server user (and I’ve occasionally struck this, where restrictive permissions masks are applied, and WordPress / plugins can’t be auto-updated for instance) , the wp-content/uploads/ folder is almost always excluded from these, to allow media uploads to function correctly.

    For Windows users, XAMPP is almost always running as the current local user, unless its running as a service, so unless you’ve put XAMPP in the C:\Program Files\ directory, and then tried to install WordPress under it, you’re unlikely to strike a permissions issue.

    Perhaps it might pay to rewrite the error message when the test write works, but the real file does not save? People might be chasing their tails otherwise.

    Nice plugin by the way! I’m a big fan of Unsplash, it’s great to be able to add some placeholder imagery when I’m comping up layouts, without having to browse / download / upload again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘XAMPP issues (Windows)’ is closed to new replies.