How to Fix Failing Imports with WP All Import on Azure

I just spent a few hours troubleshooting this issue with running WordPress on Azure. I didn’t find anything helpful online, so I figured I’d share. This post is for people who:

There have to be some people out there who do this too, right??

The Issue – Failing Imports

If you use Microsoft’s Azure App Service to host your WordPress solution, you may have heard about WinCache:

Windows Cache Extension for PHP is a PHP accelerator that is used to increase the speed of PHP applications running on Windows and Windows Server. Once the Windows Cache Extension for PHP is enabled and loaded by the PHP engine, PHP applications can take advantage of the functionality without any code modifications.

I’ve found that enabling and configuring WinCache makes the largest improvement in WordPress performance on Azure short of page caching. It provides a big boost without the (shall we say) considerations of page-level caching.

However, it does seem that WinCache’s file caching in particular throws off WP All Import. I dug into the code a bit, and it appears that CSV uploads are converted to XML, which are output to disk and then immediately read back for processing. When WinCache’s file cache is enabled, this read-back is blank. As a result, WP All Import has no data to work with. Imports run but don’t import any data.

Importantly, even previews fail, which is how I was able to quickly test for the problem. I uploaded a trivial CSV file with the following info:

 

Col1Col2
Val1Val2

 

I configured a simple import to use Col1 as title and Col2 as Body, click preview, and the title field is busted:

Screenshot of WP All Import showing warning

Strangely, when I close the preview window and click to preview again, now Content is busted too!

Screenshot of WP All Import showing two warnings

Feels like a timing issue.

Workaround – Temporarily Disable WinCache File Cache

I added the following directive to the .ini file I used to configure WinCache, with a note reminding me to tweak this before and after an import. We’ll see if I remember to do that…

; uncomment before performing import with wp all import
wincache.fcenabled=false

Don’t forget to restart your app before attempting the import again. Once done, preview (and import) work successfully:

Screenshot of WP All Import showing no warnings

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply