Skip to content

Instantly share code, notes, and snippets.

@wolffe
Created April 14, 2013 09:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolffe/5382070 to your computer and use it in GitHub Desktop.
Save wolffe/5382070 to your computer and use it in GitHub Desktop.
Tiny WordPress (tinywp.php) is a quick PHP script which auto-installs WordPress on any host. Just upload it via FTP and run it.
<?php
$n = basename($_SERVER['SCRIPT_NAME']);
unlink($n);
copy('http://wordpress.org/latest.zip', 'wordpress.zip');
$b = new ZipArchive;
$b->open('wordpress.zip');
for($i = 0; $i < $b->numFiles; $i++) {
$f = $b->getNameIndex($i);
$b->renameName($f, str_replace('wordpress/', '', $f));
}
$b->close();
$b = new ZipArchive;
$b->open('wordpress.zip');
$b->extractTo('./');
$b->close();
unlink('wordpress.zip');
header('Location: http://' . $_SERVER['HTTP_HOST'] . str_replace($n, 'wp-admin/setup-config.php', $_SERVER['REQUEST_URI']));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment