• 0

WPEngine Copy Fail, 502 Bad Gateway error


Question

Posted (edited) · Report post

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

Edited by james.pearson

Share this post


Link to post
Share on other sites

14 answers to this question

  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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
  • 0

Posted (edited) · Report post

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.

 

Edited by rsmm

Share this post


Link to post
Share on other sites
  • 0

Posted (edited) · Report post

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.

Edited by rsmm

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

/* ==================================================================
 * 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
  • 0

Posted · Report post

Thanks for sharing.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

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
  • 0

Posted · Report post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now