Title: memcache problem with Mobile_Detect.php
Last modified: August 22, 2016

---

# memcache problem with Mobile_Detect.php

 *  [abubin](https://wordpress.org/support/users/abubin/)
 * (@abubin)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/memcache-problem-with-mobile_detectphp/)
 * My server is using varnish frontend with nginx server webpages. After installing
   and enabling wp-ffpc (with php-pecl-memcached), I am getting issue with mobile
   detection. The site is using Mobile_Detect.php which is a famous php script used
   for mobile detection.
 * At first we had similar issue with varnish. We then found the solution in Mobile_Detect
   website and added the necessary code into varnish to get varnish detecting mobile
   correctly.
 * So is there similar solution for wp-ffpc as well?
 * Thanks.
 * [https://wordpress.org/plugins/wp-ffpc/](https://wordpress.org/plugins/wp-ffpc/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [abubin](https://wordpress.org/support/users/abubin/)
 * (@abubin)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/memcache-problem-with-mobile_detectphp/#post-5224125)
 * another question is…I thought memcache is used for caching database queries. 
   Why it is causing frontend issue?
 *  Plugin Author [petermolnar](https://wordpress.org/support/users/cadeyrn/)
 * (@cadeyrn)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/memcache-problem-with-mobile_detectphp/#post-5224412)
 * First of all: this is a full page cache. this means the full, rendered html is
   stored in the backend, which, in your case, is set to be memcached.
    I do not
   deal with databse cache.
 * The only thing I work with in the plugin is the url. I have no idea how mobile
   detect works; to be able to look into it, please link the Mobile_Detect.php source
   code.
 *  [LeoKesler](https://wordpress.org/support/users/leokesler/)
 * (@leokesler)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/memcache-problem-with-mobile_detectphp/#post-5224437)
 * He probably is talking about this:
 * [https://github.com/serbanghita/Mobile-Detect](https://github.com/serbanghita/Mobile-Detect)
 * I dont use that script, but I have the same issue. I am using this plugin: [http://wordpress.org/plugins/any-mobile-theme-switcher/](http://wordpress.org/plugins/any-mobile-theme-switcher/)
   to my visitors get a mobile theme, but because wp-ffpc caches the full page, 
   the mobile users get a desktop page.
 * And if a mobile user get the correct page, the desktop user will see the mobile
   theme in your monitor.
 * I tried to use this piece of code, to avoid to cache mobile user agents, but 
   it dont work. Maybe I need to put more user agents.
 *     ```
       if ( $http_user_agent ~* '(ipad|ipod|iphone|android|opera mini|blackberry|pre/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile)' )
       {
       add_header X-Cache-Engine "Mobile User Agent Detected - No Cache";set $memcached_request 0;
       }
       ```
   
 *  Plugin Author [petermolnar](https://wordpress.org/support/users/cadeyrn/)
 * (@cadeyrn)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/memcache-problem-with-mobile_detectphp/#post-5224438)
 * that code could very much help, because a variable could be set both in nginx
   and in PHP based on it, which could be use to add an additional parameter to 
   the cache key, as both the desktop and the mobile version could be cached.
 * I’ll try to come up with something nice for this in the next version.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘memcache problem with Mobile_Detect.php’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-ffpc_ffffff.svg)
 * [WP-FFPC](https://wordpress.org/plugins/wp-ffpc/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-ffpc/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-ffpc/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-ffpc/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-ffpc/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-ffpc/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [petermolnar](https://wordpress.org/support/users/cadeyrn/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/memcache-problem-with-mobile_detectphp/#post-5224438)
 * Status: not resolved