• Resolved mleder

    (@mleder)


    Hi,

    I have my own production low volume virtualized server running PHP 5.6, Mariadb, Nginx 1.9+. Several WP sites are stuck at 4.5 and cannot be updated to 4.5.2. What happens is: clicking the “please update button” in the admin area launches the update routine, and states that it is successful. However, at its conclusion, the site comes right back to v 4.5 (even though I get an email stating that the site has been updated to 4.5.2). In fact, the auto update happens a couple times per day, all with the same problem.

    So, here’s what I’ve done to track down the problem on one site as a test:
    1) Permissions: User and group set the same
    chown -R nginx:nginx /var/www/html/somesite.com/
    wp-config = 440, directories = 750, files = 640
    2) Disabled all plugins
    3) Using WP 2016 default theme
    4) Optimized and removed orphans from the database
    5) Restarted Nginx
    6) Tried removing _site_transient_update_core as some have suggested.
    7) Removed and reinstalled latest version of WP via FTP
    Nothing works. Wondering if this a Nginx issue.

    Below are two code sections for you to inspect, to see if I’m missing something:
    a) wp-config (redacted as appropriate, left out the db and salted stuff)

    /** WordPress Database Table prefix **/
    $table_prefix  = 'someprefix_';
    
    /** For developers: WordPress debugging mode **/
    define('WP_DEBUG', false);
    
    /** Absolute path to the WordPress directory. **/
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    /** Change Path to Uploads **/
    define( 'UPLOADS', 'assets' );
    
    /** Location to cache file
    define( 'RT_WP_NGINX_HELPER_CACHE_PATH','/dev/shm/nginx/' );
    **/
    
    /** SSL Parameters
    define( 'FORCE_SSL_ADMIN', true );
    define( 'WP_HTTP_BLOCK_EXTERNAL', false );
    **/
    
    /** Increase Memory Available from PHP **/
    define( 'WP_MAX_MEMORY_LIMIT', '256M' );
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    b) nginx conf file (I put all the includes together here for convenience).

    # For more information on configuration, see:
    #   * Official English Documentation: https://nginx.org/en/docs/
    #   * Official Russian Documentation: https://nginx.org/ru/docs/
    
    user  nginx;
    worker_processes  4;
    
    error_log   /var/log/nginx/error.log;
    
    pid        /run/nginx.pid;
    
    events {
        worker_connections  1024;
    }
    
    http {
    
        # Fast CGI Caching
        # fastcgi_cache_path /dev/shm/nginx levels=1:2 keys_zone=stupidfast:16m max_size=1024m inactive=60m;
        # fastcgi_cache_key "$scheme$request_method$host$request_uri";
        #fastcgi_cache_use_stale error timeout invalid_header http_500;
    
        add_header rt-Fastcgi-Cache $upstream_cache_status;
    
        charset UTF-8;
    
        # hide some server information
        server_tokens off;
        server_name_in_redirect off;
    
        include       /etc/nginx/mime.types;
    
        default_type  application/octet-stream;
    
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        # access_log  /var/log/nginx/access.log  main;
        access_log off;
    
        sendfile        on;
        #tcp_nopush      on;
        tcp_nodelay     on;
    
        client_header_buffer_size 1k;
        client_max_body_size 20m;
        client_body_buffer_size 128K;
        large_client_header_buffers 4 16k;
    
        client_body_timeout 12;
        client_header_timeout 12;
        keepalive_timeout 10s;
        send_timeout 10;
        types_hash_max_size 2048;
        server_names_hash_bucket_size 64;
    
        # Enable Gzip compressed.
        gzip on;
    
        # Compression level (1-9).
        # 5 is a perfect compromise between size and cpu usage, offering about
        # 75% reduction for most ascii files (almost identical to level 9).
        gzip_comp_level    6;
    
        # Don't compress anything that's already small and unlikely to shrink much
        # if at all (the default is 20 bytes, which is bad as that usually leads to
        # larger files after gzipping).
        gzip_min_length    256;
    
        # Compress data even for clients that are connecting to us via proxies,
        # identified by the "Via" header (required for CloudFront).
        gzip_proxied       any;
    
        gzip_buffers 16 8k;
    
        # Tell proxies to cache both the gzipped and regular version of a resource
        # whenever the client's Accept-Encoding capabilities header varies;
        # Avoids the issue where a non-gzip capable client (which is extremely rare
        # today) would display gibberish if their proxy gave them the gzipped version.
        gzip_vary          on;
    
        # Compress all output labeled with one of the following MIME-types.
        gzip_types
        application/atom+xml
        application/font-otf
        application/font-ttf
        application/json
        application/ld+json
        application/manifest+json
        application/rss+xml
        application/vnd.geo+json
        application/vnd.ms-fontobject
        application/x-font-ttf
        application/x-javascript
        application/x-web-app-manifest+json
        application/xhtml+xml
        application/xml
        font/opentype
        image/bmp
        image/svg+xml
        image/x-icon
        text/cache-manifest
        text/css
        text/javascript
        text/xml
        text/plain
        text/vcard
        text/vnd.rim.location.xloc
        text/vtt
        text/x-component
        text/x-cross-domain-policy;
        # text/html is always compressed by HttpGzipModule
    
        server {
        listen [::]:80;
        listen 80;
        server_name somesite.com www.somesite.com;
    
        root    /var/www/html/somesite.com/wwwroot;
    
        access_log  /var/log/nginx/somesite.access.log main;
        error_log   /var/log/nginx/somesite.error.log warn;
    
        # -- Error Pages
        # show "Not Found" 404 errors in place of "Forbidden" 403 errors,
        # because forbidden errors allow attackers potential insight into your server's layout and contents
        error_page 403 = 404;
    
        error_page 404      /404.html;
        location = /40x.html {
        }
    
        error_page 500 502 503 504  /50x.html;
        location = /50x.html {
        }
    
        # -- Security and Location
        location = /robots.txt  { allow all; access_log off; log_not_found off; }
    	location = /favicon.ico { access_log off; log_not_found off; }
    
    	# prevent browsing hidden files (beginning with a period) from being served
    	location ~ /\.          { access_log off; log_not_found off; deny all; }
    
        # prevent access to any files starting with a $ (usually temp files)
        location ~ ~$ { access_log off; log_not_found off; deny all; }
    
        # prevent browsing to certain wordpress files
        location ~* /wp-includes/.*.php$ { deny all; access_log off; log_not_found off; }
        location ~* /wp-content/.*.php$ { deny all; access_log off; log_not_found off; }
        location ~* /(?:uploads|files)/.*.php$ { deny all; access_log off; log_not_found off; }
        location = /xmlrpc.php { deny all; access_log off; log_not_found off; }
    
        # add trailing slash to */wp-admin requests so the admin interface works correctly
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    
        # -- Prevent Caching of Static Resources
        set $no_cache 0;
        if ($request_method = POST) {
            set $no_cache 1;
        }
        if ($query_string != "") {
            set $no_cache 1;
        }
        if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
            set $no_cache 1;
        }
        if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
            set $no_cache 1;
        }
    
        # -- Caching Controls
        # keep images, CSS and other static files around in browser cache for as long as possible, to cut down on server load
        location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
            access_log off;
            log_not_found off;
            expires max; # 360d;
    		add_header Pragma public;
    		add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    	}
    
        #location ~* .(php|html)$ {
           #access_log off;
           #log_not_found off;
           #add_header Pragma public;
           #add_header Cache-Control "public";
           #expires 14d;
        #}
    
        # -- General Directives
        location / {
            # First attempt to serve request as file, then as directory, then fall back to index.html
            # This is cool because no php is touched for static content.
            # include the "?$args" part so non-default permalinks doesn't break when using query string
            # if you're just using wordpress and don't want extra rewrites
            # then replace the word @rewrites with /index.php
            # try_files $uri $uri/ @rewrites;
            index index.php index.html index.htm;
            try_files $uri $uri/ /index.html /index.php?$args;
        }
    
        location @rewrites {
    		# Can put some of your own rewrite rules in here
    		# for example rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
    		# If nothing matches we'll just send it to /index.php
    		rewrite ^ /index.php last;
    	}
    
        location ~ \.php$ { 
    
            #fastcgi_pass_header Set-Cookie;
            #fastcgi_pass_header Cookie;
            #fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param  PATH_INFO $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
            fastcgi_intercept_errors on;
            fastcgi_pass unix:/var/run/php5.6-fpm/php5.6-fpm.sock;
    
            fastcgi_param  GATEWAY_INTERFACE    CGI/1.1;
            fastcgi_param  SERVER_SOFTWARE      nginx/$nginx_version;
    
            fastcgi_param  QUERY_STRING         $query_string;
            fastcgi_param  REQUEST_METHOD       $request_method;
            fastcgi_param  CONTENT_TYPE         $content_type;
            fastcgi_param  CONTENT_LENGTH       $content_length;
            fastcgi_param  SCRIPT_NAME          $fastcgi_script_name;
            fastcgi_param  REQUEST_URI          $request_uri;
            fastcgi_param  DOCUMENT_URI         $document_uri;
            fastcgi_param  DOCUMENT_ROOT        $document_root;
            fastcgi_param  SERVER_PROTOCOL      $server_protocol;
            fastcgi_param  HTTPS                $https if_not_empty;
    
            fastcgi_param  REMOTE_ADDR          $remote_addr;
            fastcgi_param  REMOTE_PORT          $remote_port;
            fastcgi_param  SERVER_ADDR          $server_addr;
            fastcgi_param  SERVER_PORT          $server_port;
            fastcgi_param  SERVER_NAME          $server_name;
    
            # PHP only, required if PHP was built with --enable-force-cgi-redirect
            fastcgi_param  REDIRECT_STATUS      200;
    
            # Caching Bypasses
            #fastcgi_no_cache $no_cache;
            #fastcgi_cache_bypass $no_cache;
            #fastcgi_cache stupidfast;
            #fastcgi_cache_key $server_name|$request_uri; 
    
            # Caching Expiration and Headers
            #fastcgi_cache_valid 404 60m;
            #fastcgi_cache_valid 200 60m;
            #fastcgi_max_temp_file_size 4m;
            #fastcgi_max_temp_file_size 0;
            #fastcgi_cache_use_stale updating;
            #fastcgi_cache_valid   200 302  1h;
            #fastcgi_cache_valid   301 1h;
            #fastcgi_cache_valid   any 1h;
            #fastcgi_cache_min_uses  2;
    
            fastcgi_buffer_size 4K;
            #fastcgi_buffer_size 128K;
            fastcgi_buffers 64 4k;
            #fastcgi_buffers 4 256k;
            #fastcgi_ignore_client_abort off;
            #fastcgi_connect_timeout 60;
            #fastcgi_send_timeout 90;
            #fastcgi_read_timeout 90;
            #fastcgi_busy_buffers_size 256k;
            #fastcgi_temp_file_write_size 256k;
    
            #fastcgi_pass localhost:9000; 
    
            fastcgi_param  WP_NGINX_CONFIG      done;
        }
    }
    
    }
Viewing 9 replies - 16 through 24 (of 24 total)
  • I would even try to add

    define( 'WP_MEMORY_LIMIT', '256M' );

    above

    define( 'WP_MAX_MEMORY_LIMIT', '256M' );

    even though it’s much less probable as a cause than many of the actions already tried.

    Thread Starter mleder

    (@mleder)

    Using CLI to flush the cache for the site did not solve the problem.

    Thread Starter mleder

    (@mleder)

    @kmessinger: ran the SQL as suggested in the link. Reran WP cli for clearing cache. Logged in again. Did the update, same problem.

    Thread Starter mleder

    (@mleder)

    @flower33: don’t quite understand your thoughts on this:
    fastcgi_pass unix:/var/run/php5.6-fpm/php5.6-fpm.sock;
    $required_php_version = ‘5.2.4’;
    What about the differing version numbers?

    Also, added the var you suggested to wp-config and restarted nginx. Same problem.

    You can turn off auto update and then I think you won’t get the message but that doesn’t fix the problem. Happening across the server would suggest a server problem of some sort. Maybe turn off fast CGI?

    don’t quite understand your thoughts on this:
    fastcgi_pass unix:/var/run/php5.6-fpm/php5.6-fpm.sock;
    $required_php_version = ‘5.2.4’;

    Sorry, just saw the required version still is “5.2.4” in the latest version.php file, while I had the official requirements recommendation in mind when looking at your code

    To run WordPress we recommend your host supports:
    PHP version 5.6 or greater

    So just disregard that thought.

    Thread Starter mleder

    (@mleder)

    I disabled opcache. Flushed the opcache from the command line. Rebooted the machine. Message went away. So, it’s a caching issue.

    Thanks for your help.

    Finally, congratulations!

    Hi!
    I’ve been having problems upgrading to 4.5.3 The first of my sites gets stuck on “unpacking the update” No problem… I still have a working site. The second site I tried got further in, then froze. The maintenance page is up and the site won’t start… not even after deleting that maintenance file via FTP. I get Fatal errors… okay fine. I have a migraine, but I’ll update manually… well of course not being able to get into admin, I can’t disable the plug ins. So I go to follow the instructions on how to disable them using FTP… remember the migraine. I didn’t want to get into the whole PHP thing. Now following the instructions I get to one that has me rather stymied…

    ================================================
    How to deactivate all plugins when not able to access the administrative menus?

    Sometimes it may be necessary to deactivate all plugins, but you can’t access the administrative menus to do so. One of two methods are available to deactivate all plugins.

    Use phpMyAdmin to deactivate all plugins.

    In the table wp_options, under the option_name column (field) find the active_plugins row
    Change the option_value field to: a:0:{}

    Or reset your plugins folder via FTP or the file manager provided in your host’s control panel. This method preserves plugin options but requires plugins be manually reactivated.

    Via FTP or your host’s file manager, navigate to the wp-contents folder (directory)
    Via FTP or your host’s file manager, rename the folder “plugins” to “plugins.hold”

      Login to your WordPress administration plugins page (/wp-admin/plugins.php) – this will disable any plugin that is “missing”.

    Via FTP or your host’s file manager, rename “plugins.hold” back to “plugins”

    ================================================
    Can you spot the problem? “Login to your WordPress administration plugins page…”
    If I could do that, I wouldn’t need to be trying to do it via FTP. -sigh-

    I haven’t had problems with other pages I have on the host I use updating themselves nor problems with doing auto updates. I just got a series of emails yesterday telling me that the sites were successfully updated.

    What can I do… besides sleep on it or risk going through the manual upgrade without disabling the plug ins?

    Thanks. (Sorry if I might sound cranky.)

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘WordPress 4.5.2 Daily Auto Update Fails’ is closed to new replies.