Categories

04 JUN 2013

Transfer large files between servers

I find myself in the position where I need to move a website from one host to another.  Unfortunately, the /public_html/ backup is just under 1Gb.  This means about 45 minutes to download this file, and then probably the rest of my 30′s to upload it to the new server.  So – pray do tell – how do we transfer large files From one server to another without downloading and uploading?

The Solution:

Create the following php file in the directory where you want to move the large file to.  Replace the URL with the URL to the file you want to move to the new location, and save the file as ‘upload.php’.  Now, simply open your newly created file in a browser, and wait for it to load.  When it is done – your large file will be copied over.

The code:

<?php
define('BUFSIZ', 4095);
$url = 'http://www.yourdomain.com/yourfile.zip';
$rfile = fopen($url, 'r');
$lfile = fopen(basename($url), 'w');
while(!feof($rfile))
fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
fclose($rfile);
fclose($lfile);
?>

 

13 MAY 2013

500 Internal Server error & public_html/.htaccess pcfg_openfile: unable to check htaccess file

Ever get one of those pesky Error 500 messages that you JUST CAN’T GET RID OFF?  You checked everything – file permissions.  .htaccess code (because we all know how much can go wrong there). And then you double-check everything again just to make sure. Still nothing.  So we proceed to ‘Read the Manual’ and see what the Error Log in cPanel gives us.

500 Internal Server error & public_html/.htaccess pcfg_openfile: unable to check htaccess file

Image by dwh-uk.com

Closer inspection of the error_log reveals the following error:

public_html/.htaccess pcfg_openfile: unable to check htaccess file

It took me some time to figure this one out.  Especially since most .htaccess errors can be troubleshooted by either disabling each line of code one by one or by disabling the whole .htaccess file (CHMOD it to 000) and testing out the result each time.  I noticed what looked like a syntax error regarding the Frontpage extensions but fixing it didn’t make a difference.  In  a last-ditched attempt, I first removed the extensions completely –> Still the same error.  I then reinstalled the Frontpage Extensions.

Voila.  It works. The site is loading and no further errors are being logged.

Yes.  ”What the hell?” was pretty much my reaction as well.

 

26 Apr 2013

Remove WordPress meta generator tag

Hide Wordpress from search engines

<meta name="generator" content="WordPress 3.5.1" />


If you are wanting to hide the meta WordPress generator tag from your pages – especially for security reasons, then simply add this code to your themes functions.php file:

(wp-content/themes/YOURTHEME/functions.php)

remove_action('wp_head', 'wp_generator');

 

 

  1 2 3 4 5 ... 15 30 45