Title: WordPress Admin   PHP FastCGI   502 Bad Gateway Errors
Last modified: August 22, 2016

---

# WordPress Admin PHP FastCGI 502 Bad Gateway Errors

 *  Resolved [theevent](https://wordpress.org/support/users/theevent/)
 * (@theevent)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/)
 * Hello,
 * I recently switched hosting to Media Temple Grid. Shortly after migrating my 
   website I turn on PHP 5.3.29 FastCGI because I was doing everything I could to
   speed up my site. I began experiencing 502 Bad Gateways while trying to publish
   new articles (previewing, and even scheduling articles seems to work ok, but 
   I cannot outright push the publish button or it throws a 502). Images often fail
   to upload, and even clicking around to different sections of the Admin will produce
   a 502. The 502s only happen when using the backend.
 * Because I turned on FastCGI shortly after migrating to the Grid, I did not correlate
   this problem with the PHP change at first. I thought it was a problem with the
   migration. I’ve been doing much Googling over the past few weeks trying to fix
   this and finally found other people who are experiencing the same problem, here:
 * [https://wordpress.org/support/topic/admin-attempting-redirect-to-https?replies=6](https://wordpress.org/support/topic/admin-attempting-redirect-to-https?replies=6)
 * The problem described and the server errors are _identical_ to my problem. I 
   thought I’d start a new thread, as the one I linked to is quite old.
 * I turned off FastCGI a week ago (I switched to 5.3.29 CGI (Stable) — or should
   I switch it to 5.5.18 CGI (latest)?). I am still experiencing the problem and
   my site is pretty much unusable at this point because I cannot post new articles.
 * I really have no idea how to correct this problem at this point and I’m hoping
   some of you kind people can help to point me in the right direction.
 * I’m so frustrated at this point, I am not opposed to deleting everything and 
   starting over with a fresh WordPress install and a new database. I have a current
   backup, but would this route even fix the problem since the problem appears to
   be with PHP?
 * I found the following information, but I’m not at all sure how to proceed.
 * [https://kb.mediatemple.net/questions/35/PHP+Safe+Mode,+Problems,+and+Workarounds#gs](https://kb.mediatemple.net/questions/35/PHP+Safe+Mode,+Problems,+and+Workarounds#gs)
 * [https://kb.mediatemple.net/questions/137/How+can+I+edit+the+php.ini+file%3F#gs](https://kb.mediatemple.net/questions/137/How+can+I+edit+the+php.ini+file%3F#gs)
 * [http://www.askapache.com/php/php-htaccess-tips-tricks.html](http://www.askapache.com/php/php-htaccess-tips-tricks.html)
 * I would REALLY appreciate any input anyone has to offer.
 * Thanks so much,
    Laurie

Viewing 13 replies - 16 through 28 (of 28 total)

[←](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/?output_format=md)
[1](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/?output_format=md)
2

 *  [fyaconiello](https://wordpress.org/support/users/fyaconiello/)
 * (@fyaconiello)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557100)
 * So foot in mouth. It ended up being an application code issue for me. Something
   happened in my WordPress working directory (a vulnerability / hack / ftp user
   that should have access revoked). I ended up overwriting the wp-includes and 
   wp-admin directories/content with latest (wget [http://wordpress.org/latest.tar.gz](http://wordpress.org/latest.tar.gz)).
 * Steps to debug: I downloaded the site from MT as a backup and to prepare for 
   a move assuming that it would work in whatever non-mt environment I installed
   it. It didn’t run locally. So after some troubleshooting, I tried re-installing
   WordPress, and got it to work.
 * Whatever is happening in mod_security is making finding the root cause harder
   by putting some BS in the logs, but it is not actually the cause in my case.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557102)
 * Oh, interesting! Thanks for sharing what it was!
 *  Thread Starter [theevent](https://wordpress.org/support/users/theevent/)
 * (@theevent)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557106)
 * My issue appears to have been resolved, as well. I’m getting ready to resume 
   daily posting, so fingers crossed, we’ll see how it goes!
 * To solve my problem they moved my database and php to one of their dedicated 
   SQL grid containers. My site is quite large and I do get a good amount of traffic,
   so apparently my database wasn’t getting enough resources.
 * I do find it odd that our unrelated problems were triggering errors in their 
   proprietary mod_security. Very weird. And yes, it made tracking down the source
   of the problem a lot more difficult.
 * The tech who was working with me was excellent and did a great job. Ultimately,
   if posting goes well today, I’ll still be happy with my move over to Media Temple.
   On my old host my website took roughly 13 seconds to load, but now with the combination
   of MT Grid, W3TC + Cloudflare + MaxCDN the site loads in under 2 seconds. I’m
   still not done tweaking, and I’m confident I can get it under 1 second.
 * Thanks again for your input, James. I’m glad to hear others were able to resolve
   their issues, as well. I have a feeling this thread helped to move them along.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557111)
 * Thanks for sharing your solution too!
 *  Thread Starter [theevent](https://wordpress.org/support/users/theevent/)
 * (@theevent)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557113)
 * I stand corrected. My issue is NOT resolved.
 * I got three 502s within 10 minutes of attempting to post this morning.
 * Click on Dashboard tab in admin area – 502
    Trash test post – 502 Post new article–
   502
 * This is ridiculous…
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557116)
 * Ok, maybe a reinstall will work, as it did for fyaconiello.
 * Try [downloading WordPress](https://wordpress.org/download/) again and delete
   then replace your copies of everything **except** the `wp-config.php` file and
   the `/wp-content/` directory with fresh copies from the download. This will effectively
   replace all of your core files without damaging your content and settings. Some
   uploaders tend to be unreliable when overwriting files, so don’t forget to delete
   the original files before replacing them.
 *  Thread Starter [theevent](https://wordpress.org/support/users/theevent/)
 * (@theevent)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557120)
 * James, I was just sitting down to do a reinstall. I popped in my account at MT
   to backup the database when I saw that I had a reply… after WEEKS of trying to
   get them to acknowledge the problem was on their end… they finally did! Being
   a brand new customer to Media Temple I’m not so sure how I feel about all of 
   this now. If the reinstall hadn’t worked today I was ready to move my site elsewhere.
   We’ll see how it goes for the next couple of weeks. I’m not too happy with a 
   host that is so quick to blame server problems on customers. I have not actually
   tested the website yet, so…. *fingers crossed*
 * Thanks again so much for all of your help. You’re the only one who stuck by me
   during this and let me vent. haha 🙂 You’re doing good work here James, and I
   really appreciate it! 🙂
 * ~ Laurie
    ————————————————————— The issue you have reported has been identified
   by (mt) Media Temple as possibly being part of a wider problem affecting more
   than one customer. An internal incident (INC# 4007) has been opened to track 
   the issue and to provide you collective updates as progress is made toward a 
   resolution. ————————————————————— This issue was directly related to a networking
   issue found with 2 primary core routers in our LAX datacenter. Our (mt) engineers
   were able to resolve this issue and all services appear to be functioning as 
   expected. —————————————————————
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557121)
 * You’re welcome! I’m glad they finally acknowledged the issue, and I hope it sticks
   this time.
 *  Moderator [Bet Hannon](https://wordpress.org/support/users/bethannon1/)
 * (@bethannon1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557183)
 * I am SO glad to find this thread! I too have been having wpbrute.conf errors 
   for MONTHS. I have put in a ticket at MediaTemple with the message Laurie quotes
   from them, and hope I will finally get some traction to get it fixed.
 * Laurie, what do you know about the status of the fix at MT?
 *  Moderator [Bet Hannon](https://wordpress.org/support/users/bethannon1/)
 * (@bethannon1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557184)
 * We are all obviously having the same issue at MT. Here’s an example of my error
   log:
 *     ```
       [Sat Jan 31 16:43:50 2015] [error] [client 173.255.208.145] ModSecurity: Warning. Operator EQ matched 0 at REQUEST_HEADERS. [file "/etc/apache2/mod_security/custom/wpbrute.conf"] [line "10"] [hostname "thelumc.org"] [uri "/wp-login.php"] [unique_id "VM12xs26sBEAAH@bCkUAAAA-"]
       [Sat Jan 31 16:43:50 2015] [error] [client 173.255.208.145] ModSecurity: Access denied with code 401 (phase 2). Operator GT matched 0 at USER:bf_block. [file "/etc/apache2/mod_security/custom/wpbrute.conf"] [line "20"] [id "9999001"] [msg "ip address blocked for 5 minutes, more than 15 login attempts in 3 minutes."] [hostname "thelumc.org"] [uri "/wp-login.php"] [unique_id "VM12xs26sBEAAH@bCkUAAAA-"]
       ```
   
 * So I am a little frustrated that when I quoted the “internal incident (INC# 4007)”
   from above, this is the response I got from MT:
 * `These errors are normal and are not related to the system-wide incident that
   you mentioned. What this error means is that security software that we have installed
   on the Grid detected a brute force attack on the WordPress login page. When this
   happens, the IP address of the attacker is temporarily banned. If you have any
   further questions regarding your (mt) Media Temple services, please feel free
   to contact us at any time.`
 * James, can you give us any info on whether this really might be an Apache mod_security
   thing?
 *  Moderator [Bet Hannon](https://wordpress.org/support/users/bethannon1/)
 * (@bethannon1)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557185)
 * Ok. So apparently this is a way that MT is limiting brute force attempts. I went
   through my error logs, pulled out a handful of the IP addresses that appear most
   often, and set up a deny rule in htaccess:
 *     ```
       <Files *>
       order allow,deny
       allow from all
       deny from xxx.xxx.xxx.xxx
       deny from xxx.xxx.xxx.xxx
       deny from xxx.xxx.xxx.xxx
       </Files>
       ```
   
 * My error logs now look a lot more like this:
 * `[Sun Feb 01 21:58:46 2015] [error] [client xxx.xxx.xxx.xxx] client denied by
   server configuration: /home/123041/domains/clientdomain.org/html/wp-login.php`
 * and my admin dashboard seems a little zippier (that’s what prompted my concern–
   it was taking forever to do anything in the admin dash).
 * WordFence was doing essentially the same thing, but the IP’s had to hit WP files(
   I think it’s specifically wp-admin/admin-ajax.php, given the hits to that file
   in my server log) before WF can block them, and I think that’s part of what was
   slowing the admin dash down. Since htaccess blocks them before they hit wp files,
   it’s not having to work as hard– WordFence is not logging any more blocked hits
   from those IP addresses. (Is that right?)
 * Server ninja people, here’s my question: is there a way to set up having an offending
   IP added to the deny rule in htaccess automatically?
 * Laurie, I really don’t intend to highjack your thread! 🙂 Just thought I would
   follow up here with my discovery. I am interested to hear what you have heard
   back from MT in the last month.
 *  [brent3721](https://wordpress.org/support/users/brent3721/)
 * (@brent3721)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557195)
 * Hey Bet, so the deny rule continues to work for you? I’m struggling with the 
   same issues on Media Temple as well with a wordpress installation running Wordfence
   for security, not on fastCGI
 *  [anmolview_121](https://wordpress.org/support/users/anmolview_121/)
 * (@anmolview_121)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557205)
 * just rename your plugin folder (for disable plugin) and your site will start
 * if site starts make plugin folder as previous name
    and
 * try to rename all your plugin file one by one and test …there is problem in any
   one.
 * tips: (may be problem in woocommerce-newsletter-signup)

Viewing 13 replies - 16 through 28 (of 28 total)

[←](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/?output_format=md)
[1](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/?output_format=md)
2

The topic ‘WordPress Admin PHP FastCGI 502 Bad Gateway Errors’ is closed to new 
replies.

## Tags

 * [502 Bad Gateway](https://wordpress.org/support/topic-tag/502-bad-gateway/)
 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [fastcgi](https://wordpress.org/support/topic-tag/fastcgi/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 28 replies
 * 6 participants
 * Last reply from: [anmolview_121](https://wordpress.org/support/users/anmolview_121/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/wordpress-admin-php-fastcgi-502-bad-gateway-errors/page/2/#post-5557205)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
