Title: Failed with error code invalid_response
Last modified: September 18, 2019

---

# Failed with error code invalid_response

 *  Resolved [Mariette](https://wordpress.org/support/users/mariette-jackson/)
 * (@mariette-jackson)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/)
 * Hi
 * I have been trying for 2 days now (on 3 different websites) to optimise images
   but each time I try I get:
 * Failed with error code invalid_response – The Smush process failed with an invalid
   response from the server
 * I tried both compression services but get the same response for both.
 * Can you help?
 * many thanks

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11945672)
 * Hi,
 * This error usually indicates that WP-Optimize wasn’t able to download the compressed
   image.
    WP-Optimize uses the php function `file_get_contents` to download the
   compressed image. If the PHP setting `allow_url_fopen` is disabled on your server,
   it will make file_get_contents fail. Are you able to check the value of allow_url_fopen
   on your server?
 * Best regards,
 * Marc.
 *  Thread Starter [Mariette](https://wordpress.org/support/users/mariette-jackson/)
 * (@mariette-jackson)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11947519)
 * Hi
 * I have checked and can confirm that the allow_url_fopen option is enabled.
 * The websites are hosted on SiteGround, if that helps…
 * thanks
    M
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11953110)
 * Hi,
 * Thanks. We’re working on a fix for this issue, and we hope it will be ready soon.
 * Best regards,
 * Marc
 *  Thread Starter [Mariette](https://wordpress.org/support/users/mariette-jackson/)
 * (@mariette-jackson)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11953136)
 * Great, thanks. Will you confirm when it’s OK to try again please?
 * By the way, I received an email yesterday from WPMU DEV saying “Thank you again
   for using Smush to make your WordPress images fly.” I guess that is as a result
   of me using your plugin? I’m not using Smush anywhere (although I did many years
   ago).
 * thanks
    Mariette
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11953155)
 * Yes we’ll let you know when we release the fix.
 * And no, the email from WPMU DEV isn’t from us. You’ll receive emails from us 
   only if you sign up to our newsletter or buy the premium version on our website.
 * Marc.
 *  [codingpet](https://wordpress.org/support/users/codingpet/)
 * (@codingpet)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11973929)
 * Hi Mariette,
 * I had the same issue and figured it out. In case you need it, below is the reason.
 * ‘allow_url_fopen’ is the issue. It must be enabled for wp-admin directory. On
   some servers( e.g. some cPanel why you can change PHP settings by putting a php.
   ini in the home directory ), it will only work for home directory. You need to
   put the same php.ini in the /wp-admin directory.
 * Writing a phpinfo(); in a test file and put it in /wp-admin directory to make
   sure ‘allow_url_fopen’ is enabled.
 * Kevin
 *  Thread Starter [Mariette](https://wordpress.org/support/users/mariette-jackson/)
 * (@mariette-jackson)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-11974336)
 * Hello Kevin
 * Thanks for that tip. I think this is already enabled server-wide on my Cloud 
   hosting, not in a root php.ini, but this might help someone else having a similar
   issue.
 * For me, I have decided to return to Imagify for image optimisation.
 * best wishes
    Mariette
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-12060131)
 * Hello,
 * The new release should now fix the “invalid_response”.
 * Regards,
 * Marc.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Failed with error code invalid_response’ is closed to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/failed-with-error-code-invalid_response/#post-12060131)
 * Status: resolved