Updating Wordpress: Got a PCLZIP_ERR_BAD_FORMAT error? The solution.

Written by - 0 comments

Published on - Listed in Internet Wordpress Linux


In the past few weeks I got contacted several times because of failed Wordpress updates. I knew this was working in the past - that's actually one of the main reasons why I suggest Wordpress to be used as CMS.
At first I suspected a change in the code in more recent Wordpress versions but I doubted that very much. So I went to the bottom of it.

The error message shown during the update procedure was the following:

PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

Wordpress Update: PCLZIP_ERR_BAD_FORMAT

When I was searching for that particular error message, a lot of results showed up. Unfortunately most of the advices were utter crap ("do manual upgrade instead") and had nothing to do with a technical solution. Here are some advices which I took seriously though:

  • File/Directory Permissions
    This would make complete sense, but one of the reasons why I love Wordpress as CMS is the possibility to enter the FTP credentials for the web hosting account. Therefore file permissions are not an issue in my installation, even when running under mod_php.

  • Diskspace full (http://wordpress.org/support/topic/pclzip_err_bad_format-1)
    Good idea - but in my case there was no disk space issue at all

  • Replace HTTP API (http://handshake.co.za/2012/wordpress-fixes/)
    This post suggests to replace the http.php in wp-includes with a newer one. Might have worked at some point, but doing this on a Wordpress 3.6.1 completely broke the site. 

So after going through many posts and advices, none of them was working to solve my issue and I started debugging myself.
I installed a Wordpress 3.6.1 and ran the update process so it would update the CMS to 3.7.1. To my surprise it was working immediately. What's different then from the complaints I got and my installation? The physical server location! Could it be a network related issue? I was about to find out.

After a login into this particular server, I manually downloaded the package mentioned in the update process (http://de.wordpress.org/wordpress-3.7.1-de_DE.zip):

wget http://de.wordpress.org/wordpress-3.7.1-de_DE.zip
--2013-11-25 16:43:19--  http://de.wordpress.org/wordpress-3.7.1-de_DE.zip
Resolving de.wordpress.org... 66.155.40.249, 66.155.40.250
Connecting to de.wordpress.org|66.155.40.249|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5489421 (5.2M) [application/octet-stream]
Saving to: "wordpress-3.7.1-de_DE.zip"

43% [=========>            ] 2,365,696   15.7K/s  eta 3m 36s

Jeez, look at that download speed (15.7K/s)! No wonder the update fails and the explanation is quite simple:
The update script starts. Downloading of the update package starts. After a certain time (a timeout, probably 1-2min) the update script thinks "OK, meanwhile the update package should have been downloaded, so unzip it". As the download is far from being finished, the zip file is incomplete. Ergo the ZIP error message PCLZIP_ERR_BAD_FORMAT!

Together with the network team in the data center I was able to solve this issue. There was a recent change in the network infrastructure where this server was physically located and the communication between the switch port and the server was set to "Auto-Negotiation: No". After activating auto-negotiation on the physical NIC of the server (ethtool -s eth0 autoneg on), the network communication was fixed and the download speed increased rapidly.

Back to Wordpress. Once logged in, I launched another Wordpress update on the admin interface. And surprise, surprise - it immediately worked. Case closed.

Conclusion: If you get the PCLZIP_ERR_BAD_FORMAT error when doing a Wordpress update, make sure your server is actually able to download the update package within 1 minute.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder