Tag Archives: wordpress

ftp unzip

Here’s a little trick for web masters out there who upload and extract wordpress, prestashop, joomla or any other open source products with loads of fiddly little files that normally take an age to upload via ftp.

The usual case is you extract the zip locally and upload the few thousand files via FTP and even with a nice wide broadband pipe it can take time to upload each file individually. A better solution would be to upload the zip file via ftp and then log in to your server using ssh or whatever to extract the file, but sometimes it can be a pain on shared hosting to set up ssh and then go through setting up logins etc. or maybe you don’t have that option at all.

Here’s an alternative that might save a few minutes. Look, I’m lazy OK!

What I do is run a little script on the server that calls a method on the ZipArchive class.

The example below extracts the prestashop zip file to the same directory that the archive is in.

//new zip archive object
$zipArchive = new ZipArchive;

//file to unzip in same directory as this script
$fileToUnzip = "prestashop_1.5.3.1.zip";

//retrieve current path from the zip
$unzipPath = pathinfo(realpath($fileToUnzip), PATHINFO_DIRNAME);

//open and extract the zip file
if ($zipArchive->open($fileToUnzip) === TRUE) 
    echo "Unzipping $file to $unzipPath...<br/>";
    echo "Hey presta!!!";
    echo "Cannot open $fileToUnzip... Doh!";

If the zip file extracts to a subfolder it will only take seconds to copy the files back to the root directory, if that’s what is required.

Might be handy for someone.

WordPress White Screen of Death (wp-admin blank screen problem)

If anyone out there is experiencing the WordPress white screen of death i.e. when you go to your wordpress wp-admin folder all you see is a blank screen, you may have been hacked.

I had a nasty little hack where link code was being injected into the footer of every rendered page. It was difficult to find as the links that were being injected were injected by an encoded script that had infected several files (especially in my themes folder). I went through each file and deleted the script from them. In this case, if you’re not experienced with code you would be safer to do a full re-install of your blog.

The result of the clean up was that several files had spaces injected into them at the top and bottom of the page. I did a full re-install to restore all the important files in the system and I still was experiencing the blank screen. Obviously wp-config.php wasn’t part of the update and so I cleaned out a blank line on the top of this module and I could finally log back in again.

Hope this helps someone out there.

Note: If you have been hacked, change all of your passwords, database, ftp, wordpress etc. and make sure that all file permissions on your server are set up correctly, be pessimistic.