Downloading and Installing WordPress on cPanel servers

Most times, the hosting folks don’t provide SSH access and here’s how you can download and install WordPress or for that matter anything that’s downloadable. You need the x3 theme with the new file manager though.

First you need to make the public_html to a writable directory and create and upload the file with following code…

<?php
 
/**
 * Download Wordpress directly to the server...
 *
 */
 
function get_by_curl($url){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $c = curl_exec($ch);
  curl_close($ch);
  return $c;
}
 
 
$content = get_by_curl( 'http://wordpress.org/latest.tar.gz' );
 
file_put_contents( 'latest.tar.gz', $content );

You can now make the public_html non-writable. You’ll be able to extract the latest.tar.gz using the Extract icon on the file manager and you can install it as you would normally. The extracted folder is called wordpress and you can rename it to whatever you want or take it to the main folder. Make sure you do this before you installed it.

Leave a Reply

Your email address will not be published. Required fields are marked *