Jump to content

Archived

This topic is now archived and is closed to further replies.

JimP

WPEngine Copy Fail, 502 Bad Gateway error

Recommended Posts

JimP    1
JimP

Hi there, 

I have been dealing with the people at www.wpengine.com where I host my pagelines DMS site. Currently, the "copy site" function, doesn't work on WPengine, it seems because of a dms theme issue. 

 

I'm running the latest pagelines version, 2.1 here's the WPengine's engineer's comments, as below;

 

I checked out the bigtclub install that was cloned out. After some digging I saw that the .htaccess wasn't showing correctly, so I updated it. In the test it was still giving the 502 error.

Next I checked the plugin and theme. I deactivated the plugins and reverted the theme to twentyfourteen. After clearing the cache and testing the site the wp-admin page finally loaded up for me. I turned the plugins back on and site was still up. Then when I turned the theme back on the 502 came back.

So it looks like something in the dms theme is causing the 502 error. I would suggest contacting the theme developer and see what they can find. Here is a section of the error log that you can show the developer and maybe it will point them where to check.

 

Here's the error message; http://paste.pagelines.com/DOEDyydd

 

In the mean time i've left the theme as twentyfourteen so you can access it now.

I'll leave the ticket open just incase you have any further questions but if you feel this is resolved on our end let us know.

 

thanks for any help with this, as I can not easily copy my site currently. - Jim

Share this post


Link to post
Share on other sites
Simon    247
Simon

So do you use the propricing section? Or is it just an empty folder?

 

Its pretty obvious what PHP is telling you in that error: Failed opening '/nas/wp/www/cluster-2262/tsresales/wp-content/themes/dms/sections/propricing/section.php'

So that file does not exist, but PHP is expecting it, so why on earth were they doing updating a htaccess file?

 

Check your folders, see if that file exists.

Share this post


Link to post
Share on other sites
JimP    1
JimP

Hi Simon - I do use the pro pricing section and it seems to work fine. I'm not sure why it is failing to see the file, or if the file exists in the right place, but will look around in the folders to see what I can find. Thanks for your reply; it may seem obvious, but i'm new to creating sites - thx again.

Share this post


Link to post
Share on other sites
Simon    247
Simon

Well a 502 gateway error is nothing to do with any PHP script/theme/app whatever, thats the HTTP server not being able to connect to the PHP server. So them blaming DMS for a 502 is a bit strange.

Share this post


Link to post
Share on other sites
rsmm    1
rsmm

I've been experiencing issues with cloning installations that use DMS hosted by WP Engine. And I think I've narrowed down the issue. 

 

It appears that after the site is cloned, there are entries in the database that provide the path to the sections that are being used on the site. When you clone a site, this database entry is not updated, and DMS continues to attempt to load sections using the path of the old installation.

 

The database entry in question is in the options table, named: theme_mods_theme-name

 

I can delete the contents of that entry, and the site will load. Is there an easier way to do this? I haven't checked if it destroyed content or settings yet.

Share this post


Link to post
Share on other sites
Simon    247
Simon

I wouldnt delete that entry, a lot of data is stored there.

 

Clicking the reload sections button would clear it.

Share this post


Link to post
Share on other sites
rsmm    1
rsmm

Unfortunately I can't get to the button because I get a 502 bad gateway error until I clear the database entry. Is there another way to trigger it? Any idea what function that button is linked to? Maybe a query string could be added to trigger whatever that button does. Otherwise I don't really see a way to fix this on a site you can't get into.

Share this post


Link to post
Share on other sites
Simon    247
Simon

If you have access to the dms developer plugin there is a purge URL you can use.

 

To remote purge all caches and update the js/css cache number use this url:link

 

Otherwise you need to clear the theme option with something like this:

 

set_theme_mod( 'editor-sections-data', array() );

 

But only run it once, dont leave that running on every page load ;)

 

Share this post


Link to post
Share on other sites
JimP    1
JimP

Hi RSMM and Simon - I went into myPHP admin and simply renamed the "current_theme" from "DMS" and replaced that with another theme - "twentyfourteen". Once this was completed, I could then login to my site on WPengine. Before that, it was a 502 error. 

 

I deactivated DMS 2.1 as the site was missing some formatting and objects were not loading as they should. After re-activating, the site appears to be copied fairly well. Hope that helps.

 

Simon, I am a non technical webadmin, and really enjoy using DMS 2.0. I can't see how you can blame a copying error on WPengine, when it appears that it is related to the DMS theme. Other themes copy without any issue. But of course, I'm not really qualified to analyze the issue. thanks all for the help in general.

Share this post


Link to post
Share on other sites
rsmm    1
rsmm

Good news, armed with this knowledge I was able to create solution with a few lines of code. I added this to the top of my child theme's functions.php file. It checked to see if the path stored in the database points to an actual file. Since it's the Canvas area included with the DMS parent theme, it's a safe bet that this path should point to a real file. If it doesn't it's safe to assume that this data is stale and needs to be refreshed. This will clear that area of the theme mod. 

// Clear paths stored in database if plSectionArea doesn't exist at saved path
if( !file_exists($editor_sections_data['parent']['PLSectionArea']['base_dir']) ){
  set_theme_mod( 'editor-sections-data', array() );
}

I hope this helps others. This would have saved me about a week of frustration and sadness.

 

Share this post


Link to post
Share on other sites
rsmm    1
rsmm

Whoops, I forgot to paste a line. Editing now.

 

**update**

apparently I can't update my old post. So I guess I'll create a new one with the correct code.

Share this post


Link to post
Share on other sites
rsmm    1
rsmm
/* ==================================================================
 * Fix for WP Engine 502 Gateway error 
 * Clear paths stored in database if plSectionArea doesn't exist at saved path 
 */
$editor_sections_data = get_theme_mod('editor-sections-data');
if( !file_exists($editor_sections_data['parent']['PLSectionArea']['base_dir']) ){
	set_theme_mod( 'editor-sections-data', array() );
}
/* ================================================================== */

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Thanks for sharing.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
dawsonbarber+    19
dawsonbarber

I had the same problem.

 

WP Engine had a senior engineer look at things and found that the root cause was that the theme (I'm using iBlogPro6) is coded to set options using the absolute server path instead of the relative path.

 

Did a search and replace (of the copy-from and copy-to domain name) with this: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/and everything loaded as it should.
 
Incidentally, this issue doesn't just affect installation copies, but also migrations.

Share this post


Link to post
Share on other sites
dawsonbarber+    19
dawsonbarber

EDIT: I realized that this thread is part of a PageLines sub-forum, not DMS, so I created a new ticket under DMS.

Share this post


Link to post
Share on other sites

  • Similar Content

    • JawDesigns
      By JawDesigns
      Hi everyone,
      Flywheel have reported errors on my clients site 'www.racewaredirect.co.uk' and it's not loading. Can someone please provide some information on how to fix this? The site has never experienced these issues before.
      Thanks,
      James Wilson
    • micstepl
      By micstepl+
      always says "FAILED"
      (I am in new Platform5)
    • dawsonbarber
      By dawsonbarber+
      Trying PL5 on a new WP Engine hosted installation (using a child theme for PL framework) with SSL cert and style is "gone."
    • achim
      By achim
      Dear everybody,
      I'm Using DMS 2 on WPEngine and after asking myself where my site was gone this morning - all page settings were lost - I just got this message from my host service WPEngine:
       
      417539 pl-settings 184137 pl-user-templates  
      I wouldn't expect that WPEngine changes their behavior so what could I do to prevent database entries in wp_options to grow that large? What exactly is stored there that can be larger than 1 MB and how can I reduce the size?
    • achim
      By achim
      Dear everybody.
       
      We are using pagelines in an WPEngine environment that is cached by a varnish.
      Whenever an editor makes a change eg on the home page the less will be re-compiled, which takes up to a few seconds.
      What we witness then nearly every time is that the page references css that point to a 404, which makes the entire page unusable of course.
      This lasts until the cache-age expires which is in our case 10 looong minutes
      If we re-publish the page the problem is gone (most times or it re-happens).
       
      Just trying to understand, maybe this is what happens:
      I didn't find a pattern of how compiles-css files are stored or deleted. e.g. yesterday we published a couple of changes and there is no css file in the uploads directory from yesterday but many from last month etc.
      I think the process might be like so:
      1. I publish a page
      2. the old css is deleted
      3. in the meantime the page is broken and will be cached with 404 css references
      4. then new css is re-compiled and saved to the uploads dir
      5. the reference to the new css is saved to the database
      6. after 10 minutes (cache-age expired) the new css is available
       
      If this is the case pagelines doesn't support varnish - am I right?
      Pls. let us know how to proceed. We have a large print campaing leading traffic to our site and it's broken as soon as we edit a thing.
       
      Thanks in advance 
      Best regards
      Achim Koellner
×