WordPressのHTTP画像アップロードエラーを修正する必要がありますか?
このエラーは、WordPressでコンテンツを作成しているときに特にイライラさせられます。通常、WordPressのビルトインメディアライブラリを使って画像やその他のファイルをCMSにアップロードしているときに発生します。
この投稿では、WordPressのHTTP画像アップロードエラーを簡単に修正する方法を紹介します。
WordPressでメディアアップロード中にHTTPエラーが発生する原因は?
WordPressメディアアップローダーを使用してWordPressサイトにファイルをアップロードしようとすると、多くのことがHTTPエラーにつながる可能性があります。
基本的に、WordPressは原因を突き止めることができず、そのために一般的な「HTTPエラー」メッセージが表示される。
このWordPress HTTPエラーのもどかしい点は、エラーの原因について何の手がかりも与えてくれないことです。つまり、原因を見つけてエラーを修正するために、さまざまな解決策を試さなければならないのです。
ということで、WordPressでメディアアップロード中のHTTPエラーをトラブルシューティングして修正する方法を見ていきましょう。以下のリンクから特定の方法に飛べます:
- Method 1: Make Sure the HTTP Error Is Not Temporary
- Method 2: Deactivate All Plugins and Your Current Theme
- Method 3: Increase WordPress Memory Limit
- Method 4: Change the Image Editor Library Used by WordPress
- Method 5: Use the .htaccess Method
- Method 6: Update Your PHP Version
- Method 7: Check File and Folder Permissions
- Method 8: Enable Debug Mode
- Method 9: Check Your Hosting Resources
方法1:HTTPエラーが一時的なものではないことを確認する
まず、数分待ってから、WordPressサイトに画像ファイルを再度アップロードしてみてください。このエラーは、異常なトラフィックやサーバーリソースの低下によって発生することがありますが、ほとんどのWordPressホスティングサービスでは自動的に修正されます。
それでもうまくいかない場合は、以下のうち1つ以上を試してみるといいだろう:
- ブラウザーを更新するか、ブラウザーのキャッシュをクリアしてください。
- ファイルサイズを変更してファイル名を変更し、メディアライブラリに再度アップロードします。ファイルサイズを小さくする画像最適化プラグインのリストをご覧ください。
- 別のフォーマットで保存する。例えば、画像編集ソフトを使ってJPEGをPNGに変更することができます。その後、ファイルのアップロードを再試行してください。
これらの手順をすべて踏んでもHTTPエラーが発生する場合は、一時的な不具合によるエラーではないため、早急に対処する必要があります。
方法2:すべてのプラグインと現在のテーマを無効化する
WordPressのプラグインを新規インストールしたばかりの場合、他のプラグインとの互換性がなく、画像のアップロードプロセスが中断される可能性があります。この場合、WordPressのプラグインをすべて無効化してください。
WordPressプラグインを無効化するとHTTPエラーが消える場合、そのプラグインがHTTPアップロードイメージエラーの原因である可能性があります。別のプラグインをインストールするか、開発者に連絡してサポートを受けてください。
詳しくは、WordPressプラグインをすべて簡単に無効化する方法と、WordPressダッシュボードにアクセスできないときにプラグインを無効化する方法のガイドをご覧ください。
同様に、テーマのコンフリクトが画像のアップロードプロセスを妨害することもあります。テーマには、WordPressがメディアアップローダーを処理する方法を妨害するような機能が含まれていることがあります。
幸いなことに、テーマの衝突を特定するのは比較的簡単です。一時的にデフォルトのWordPressテーマに切り替えることができます。詳しくは、WordPressテーマを適切に変更する方法をご覧ください。
デフォルトテーマを有効化したら、もう一度画像をアップロードしてみてください。エラーが消えた場合は、現在のテーマに問題がある可能性が高いです。この場合、テーマの更新が可能かどうかを確認することができます。多くの場合、更新によって互換性の問題やバグが修正されます。
あるいは、テーマ開発者にサポートを求めることもできます。パッチを提供してくれるかもしれませんし、競合を解決するためのガイダンスを提供してくれるかもしれません。
方法3:WordPressのメモリ制限を増やす
WordPressはPHPプログラミング言語で書かれています。さらに、異なるPHPプロセスに割り当てられるメモリの量は、Webホスティングサーバーによって決定されます。
画像のアップロードにPHPメモリが必要な場合、WordPressでHTTP画像アップロードエラーが表示されることがあります。
これを解決するには、サーバー上でPHPが使用できるメモリを増やす必要があります。
まず、FTPクライアントまたはウェブホスティングダッシュボードのファイルマネージャーアプリを使用して、サイトのファイルにアクセスする必要があります。次に、ルートディレクトリに移動し、wp-config.phpファイルを見つけます。
その後、テキストエディターを使ってwp-config.phpファイルを編集し、以下の行を追加する必要があります:
define( 'WP_MEMORY_LIMIT', '256M' );
このコードはWordPressのメモリ制限を256MBに増やし、メモリ制限の問題を解決するのに十分だろう。
最後に、ファイルを保存してサーバーにアップロードしなければならない。
さらに詳しく知りたい方は、WordPressのPHPメモリ制限を増やす方法のステップバイステップガイドをご覧ください。
方法4:WordPressが使用するイメージエディターライブラリを変更する
WordPressはPHPで動作し、画像を扱うために2つのモジュールを使用します。これらのモジュールはGDライブラリとImagickと呼ばれます。WordPressは、利用可能なモジュールによってどちらかを使用します。
しかし、Imagely はメモリの問題にしばしば遭遇し、画像のアップロード中に HTTP エラーが発生します。これを解決するには、GD ライブラリを画像エディタの初期設定にします。
WordPressテーマのfunctions.phpファイルにこのコードを追加するか、WPCode(推奨)を使用するだけで実行できます:
function wpb_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'wpb_image_editor_default_to_gd' );
詳しくは、WordPressでカスタマイザーコードを追加する方法をご覧ください。
このコードを追加した後、メディアアップローダーを使用してファイルのアップロードを再試行できます。それでも問題が解決しない場合は、このコードを削除して、この投稿に記載されている他の方法を試してください。
方法5:.htaccessを使う
この方式では、Imagick がサーバーリソースをどのように使用するかをコントロールできます。多くの共有ホスティングサービスでは、画像処理を高速化するために Imagick が複数のスレッドを使用することを制限しています。しかしその結果、画像をアップロードする際に HTTP エラーが発生することになります。
簡単な方法は、.htaccessファイルに以下のコードを追加することです:
SetEnv MAGICK_THREAD_LIMIT 1
このコードは、Imagick が画像処理に使用するスレッドを個別に制限するだけです。
方法6:PHPのバージョンを更新する
WordPressサイトが古いバージョンのPHPを使用している場合、HTTP画像アップロードエラーが発生する可能性があります。新しいバージョンのPHPはパフォーマンスが向上しており、一般的にメモリ使用量が少ないからです。
幸いなことに、サイトのPHPバージョンをチェックして更新するのは簡単です。詳しくは、WordPressでPHPのバージョンを更新する方法についての初心者向けガイドをご覧ください。
方法7:ファイルとフォルダーの権限を確認する
WordPress が正しく機能するためには、特定のファイルやフォルダーの権限に依存しています。権限が正しくない場合、WordPressがファイルにアクセスしたり変更したりできなくなり、アップロードエラーにつながる可能性があります。
例えば、アップロードディレクトリに適切な書き込み権限がない場合、WordPressはアップロードした画像を保存できません。
正しい権限を確認するには、WordPressのファイルとフォルダーの権限エラーを修正する方法をご覧ください。
方法8:デバッグモードを有効化する
PHPの根本的なエラーがHTTP画像アップロードエラーとして現れることがあり、トラブルシューティングを困難にしています。
WordPressの設定でデバッグモードを有効化すると、デバッグログにPHPエラーが表示され、アップロードの問題の根本的な原因に関する貴重な手がかりが得られます。
WP_DEBUGモードを有効にする方法については、WordPressのデバッグモードを有効にする方法の投稿を参照してください。このガイドでは、必要なコードを wp-config.php ファイルに追加する手順を順を追って説明します。
方法9:ホスティングサービスのリソースをチェックする
お客様のサイトがストレージ容量に達した場合、またはサーバーリソースに制限が発生した場合、アップロードエラーが発生する可能性があります。たとえば、ディスク容量が不足していると、WordPress が画像のアップロードに必要な新しいファイルやフォルダーを作成できないことがあります。
ほとんどのホスティングサービスプロバイダは、ディスク容量を含む、あなたのウェブサイトのリソースの使用状況を表示することができますコントロールパネルを提供しています。表示されない場合は、ホスティングサービスプロバイダーのサポートチームにお問い合わせください。
ストレージの上限が近づいている場合は、リソースの最適化を検討してください。例えば、大きな画像ファイルはストレージを大量に消費します。アップロードする前に画像を最適化してファイルサイズを小さくすることができます。
リソースの最適化だけでは不十分な場合は、より多くのストレージ容量を持つホスティングプランへのアップグレードを検討してください。これにより、サイトのファイルに必要な容量が追加されます。
あなたは寛大なストレージ容量を持つ信頼性の高いWordPressホスティングサービスプロバイダを探しているなら、Bluehostは人気のオプションです。彼らはさまざまなサイトのニーズに合わせて様々なプランを提供しています。
この投稿がWordPressのHTTP画像アップロードエラーの修正にお役に立てば幸いです。WordPressのよくあるエラーとその対処法、ブロックエディターのよくある不具合もご覧ください。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
John says
not worked with any method
WPBeginner Support says
If none of the methods in this article worked, you may want to reach out to your hosting provider to try the general troubleshooting steps in our article: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
管理者
Sandy says
I tried Option 3. Now my entire home page is blank. Individual pages are still there. The Sidebar is still visible, but the rest of the home page is blank.
Please help if possible.
Thank you,
Sandy
WPBeginner Support says
You may want to ensure you didn’t change your homepage settings while troubleshooting and have you removed the code to see if that solved the missing content?
管理者
Sanju says
Worked like charm Option 3.
While My wordpress admin panel is slow.. Working on it. Any guide?
WPBeginner Support says
You may want to try disabling your plugins to see if one of your plugins could be slowing the admin area.
管理者
Lucas Vidal says
Method #3 worked like a charm
WPBeginner Support says
Glad our guide could help
管理者
Mounika says
Thank a lot ! 3rd option worked for me.
WPBeginner Support says
Glad our article could help
管理者
Rahana Razak says
Thank you sir, its working (3rd one worked for me)
WPBeginner Support says
Glad our article could help
管理者
Adriana says
Hello,
I have tried all of them steps, and none has worked, I am not sure what else to do at this point , as i’m on limited time and would need this fixed , if any other ideas please do help. Thank you so much
WPBeginner Support says
You may want to reach out to your hosting provider to see if they see any errors on their end that could be causing the issue.
管理者
Karan says
Thanks. It works by changing the default image file library.
WPBeginner Support says
Glad our article could help solve the issue
管理者
SL101 says
thank you so much, 3rd solution did the trick.
WPBeginner Support says
Glad our article could help
管理者
DrewDownz says
Number 3! Pow! Now lets hope in shows up in other browsers!
WPBeginner Support says
Glad our article could help
管理者
Salbin Sajan says
Hello brother… Thanks for your article ..
#3 Solved the issue ..
Thanks again ..
WPBeginner Support says
Glad our tutorial could help
管理者
Tina says
Hi,
thanks for this guide. Unfortunately, all these ideas did not work for me. Today, in an attempt to remove the “website is on partially safe” SSL certificate message, I used “Search and Replace” plugin to search my databases for “http” and changed those to “https”. That’s the only thing I could relate to this error, but since I am no expert on this, I don’t know how and if I can fix this or how I can undo these changes. Any help?
WPBeginner Support says
For your site having mixed content you would want to take a look at our SSL issues article rather than this one: https://www.wpbeginner.com/wp-tutorials/how-to-fix-common-ssl-issues-in-wordpress-beginners-guide/
管理者
kyle says
Hi i get the http error everytime i upload an image over 4mbs. I have contacted my web designer and host and they have both tried to load images over 15mbs and it is working for them. However, i have tried mulitple computers on different internet connections and i still get the http error. Can u please help?
WPBeginner Support says
If none of the methods in this article resolve the issue you may want to try creating a new user to see if it is due to an issue with your user or the general troubleshooting steps in: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
管理者
Hien says
I just wanted to comment, #3 definitely helped with 503 error/http error when uploading pictures sometime. Other time, upload pictures fine.
WPBeginner Support says
Thanks for sharing and glad our article could help resolve the issue
管理者
rahul sharma says
Sir in the function.php where should i put the code??? {in the end or In the middle}
WPBeginner Support says
You would normally want to put added code at the end in case you need to edit or remove the code later
管理者
Cindy says
Thank you so much! The third option worked for me!
WPBeginner Support says
Glad our guide could help
管理者
Mike Gaudreau says
In my case, I simply logged out of the dashboard and right back in and the problem was cleared.
WPBeginner Support says
Thanks for sharing that, it sounds like either your caching had a hiccup or you ran into one of the server issues
管理者
Mohamed says
You can’t imagine the level stress of this HTTP thing has created on me. Number 3 is my lifesaver. Thank you for posting this.
WPBeginner Support says
Glad our article could help
管理者
OA says
Thanks! Option 3 work for me.
WPBeginner Support says
Glad our recommendation worked
管理者
Mohamed says
Thanks…Method 3 did it well
WPBeginner Support says
Glad our article could help
管理者
Janet says
I had about 10 pictures to upload and repeatedly got the HTTP error for 3 of them. I finally sussed that those three had an apostrophe in the file name!!! Doh! Removing the apostrophe was the solution.
WPBeginner Support says
Thanks for sharing your solution, glad you were able to get the files uploaded
管理者
Hector says
Thanks, Number 3 did the trick. Awesome tutorial.
Rae says
No. 3 worked for me too. Thank you for this!
WPBeginner Support says
Glad our article could help
管理者
Sandra says
Thanks for this! Number 3 fixed my problem
William Davidson says
#2 worked for me. Easy peasy. Thanks for helping me fix it.
WPBeginner Support says
Hey William,
Glad you found it helpful. Don’t forget to join us on Twitter for more WordPress tips and tutorials.
管理者
Magloire says
This issue really stressed me up. No 3 solved my problem.
Thanks
Yann says
3 worked for me too. I copied right at the end of function.php in Appearance > editor of WordPress
Eylene says
Hi there,
Option 3 is working for me! Thank you so much this was driving me insane!!!
Alissa says
Before I tried any of these solutions. I tried logging out of WordPress and logging back in, and suddenly I stopped getting the error message. So, you might want to try that first.
Isla S says
I’ve noticed that this keeps happening to me with files that contain apostrophes in the filename. When I remove it, they upload fine
Perhaps try to remove the ‘ ?
Wanda says
THANK YOU! Removing the ‘ worked for me
Andy says
Thank you! This was driving me crazy, had been trying to solve this for a friend for days
Marek says
No. 3 works, thanks.
Christina says
None of these worked for me. After some more researching, I found that putting this bit of code at the bottom of the .htaccess worked for me:
# Exclude the file upload and WP CRON scripts from authentication
Satisfy Any
Order allow,deny
Allow from all
Deny from none
Don’t forget to back up your .htaccess file first just in case!
Savi Huang says
None worked. Pls help!
NICOLE says
Number 4 worked for me!!! Thanks so much!
Pat Smithers says
No. 3 worked a charm.
Thank you so much!
mike says
Please can will this solutions work on a localhost installation of wordpress?
WPBeginner Support says
These methods should work with localhost, the memory limit may need to be modified using the program for your server such as MAMP or WAMP
管理者
Omar Ajruli says
Option number three fixed my problem guys, thank you. Have a great day.
3. Change Image Editor Library Used by WordPress.
Ali HyDer says
Its Working for me! Yuppiiiiiiiiiiiiiiiiii
Thanks Syed Balkhi
Emmanuel Usen Jackson says
My blog shows me “An error occurred in the upload. Please try again later.”. Please what should I do?
Jake says
Try again later
John says
Tried all to no avail UNTIL i added the code to the functions.php file. A BIG thank you!
Dan says
Adding that line to my .htaccess file did the trick! Thanks!
vishwas says
i did all the above changes in my site still image is not uploading, please help me to resolve this issue (http error)
Casey says
THANK YOU! Changing the image editor worked for me.
David says
For me, the issue was a series of pictures with an apostrophe in the title. Renamed and it worked fine.
Tom Jaggard says
I need help resolving the HTTP error when uploading large files. Someone else created my site with an upload size limit of 64Mb. I am trying to upload audio files that are sometimes larger than 64Mb. I added a plug-in (Upload Max File Size) to change my max upload size to 128Mb. I changed memory_limit in PHP.ini to 256M. I change max_execution_time in PHP.ini to 300. I set memory_limit in wp-config to 256M. I changed memory_limit in .htaccess to 256M. I tried adding the code to .htaccess to force it to use the GD Library instead of Imagick. It didn’t work, so I remove that code and then added the line to limit Imagick to 1 thread. In spite of all of these changes, I still get the HTTP error when loading a file larger than 64Mb.
Any more ideas?
Thanks!
siddharth pathak says
thanks a lot, I was trying to fix this from last 2 hour and after reading this article did it in just few sec and already tested thanks a lot
Mauricio Lazo says
As a side note, another thing that can be giving you HTTP errors while uploading images is a configuration in you php.ini file, specifically the line “max_execution_time=30;”.
Some shared hosting providers limit PHP execution to a single core of the server, increasing the time it takes for PHP Imagick to get the image, process it and create thumbnails. So the suggestion is to increase max_execution_time to 120 seconds instead of the default 30 seconds.
wassim jied says
Hello
In my case
function wpb_image_editor_default_to_gd( $editors ) {
$gd_editor = ‘WP_Image_Editor_GD’;
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( ‘wp_image_editors’, ‘wpb_image_editor_default_to_gd’ );
worked fine thanks
Php Memory limit 128Mo v 7.13 apache 2.4
Joost Walter says
One of the causes of an upload error is the fact that there is an apostrophe in the name of the file that you try to upload. For instance a picture called ‘Let’s_dance.jpg’ will give an error, while ‘Lets_dance.jpg’ can be uploaded without any problems.
Floz says
This was the problem in my case, thank you so much!! Saved me a lot of hassle ^_^