Install WordPress Manually Using PHP

  • Author: Sajjad Hossain
  • |
  • Added: Jul 31, 2016
  • |
  • In: PHP Snippets

We know Wordpress is most popular CMS over the world. It's easy to use and for this reason, it's occupied edge. A person who don't know a single line of coding he can create a site using WordPress. In this article, I am going to show how to Install WordPress Manually Using PHP. Usually, we download WordPress and upload it to a server using cPanel. We need to download WordPress first then need to upload this to the server. But there is an easy way to Install WordPress without download and upload manually. I am Introducing you a simple PHP snippet whether that help you to skip the manual process and upload WordPress to your website automatically. This snippet will upload WordPress latest version and unzip this into your website into a WordPress folder. Let's see the snippet how to import WordPress.

Import WordPress Using PHP


Create a PHP file in your server and write down this code into this file.

<?php
@ini_set('error_log',NULL);
@ini_set('log_errors',0);
@ini_set('max_execution_time',0);
@set_time_limit(0);
@set_magic_quotes_runtime(0);
$wpURI = 'https://wordpress.org/latest.zip';
$file = 'wp.zip';

if(isset($_GET['import'])&&$_GET['import']=='true')
{
if(copy($wpURI,$file))
{
echo 'file imported successfully!<br/>';
echo '<a href="?extract=true">Extraact Now</a>';
}
else
{
echo 'file import error!';
exit;
}
}
else
if(isset($_GET['extract'])&&$_GET['extract']=='true')
{
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
$zip->extractTo('./');
$zip->close();
echo 'zip file extracted!';
unlink($file);
} else {
echo 'ERROR: FILE NOT EXTRACTED!';
exit;
}
}
else
{
echo '<a href="?import=true">Import WordPress</a>';
}
?>

Install WordPress Manually Using PHP Video Tutorial

This snippet import WordPress latest zip file directly from wordpress.org and extract this into your server. A directory name as WordPress will create automatically. Now you need to configure this.

Now setup WordPress regular way. Connect your database and run the installer. I hope you already know how to install WordPress and you understand this. If you have any question or comment about this Install WordPress Manually Using PHP article please don't hesitate to do that, please comment your question in comment section.


Search
I am...

Sajjad Hossain

I have five years of experience in web development sector. I love to do amazing projects and share my knowledge with all.

NEED HOSTING?
Are you searching for Good Quality hosting?
You can Try It!
Connect Social With PHPAns
Top