0

I would like to install Drush on my shared hosting account in order to let a cronjob call a specific module to this installation.

I have NO SSH access and NO Composer access on this shared hosting account and will not get it neither. I can setup a crontab job and run a call.

I looked extensivly to install drush but cannot find it.

Please do not answer that I should use SSH or composer. These answers will not be helpfull :-)

  • 1
    Dont think there is any way. All you can do is ask your hosting provider to do it. If they say no then you'll have to move provider – Leigh May 10 '18 at 15:54
0

Rather than using drush, consider writing a custom script you can call instead.

In Drupal 7 you can bootstrap Drupal from the command line like this:

<?php
chdir('/var/www/YOUR SITE ROOT');

// no time limit!
set_time_limit(0);

// set some server variables so Drupal doesn't freak out
$_SERVER['SCRIPT_NAME'] = '/importer.php';
$_SERVER['SCRIPT_FILENAME'] = '/importer.php';
$_SERVER['HTTP_HOST'] = 'somewhere.com'; 
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['REQUEST_METHOD'] = 'POST';

// change to the Drupal directory
define('DRUPAL_ROOT', getcwd());

 // Drupal bootstrap throws some errors when run via command line
 //  so we tone down error reporting temporarily
error_reporting(E_ERROR | E_PARSE);

// run the initial Drupal bootstrap process
require_once('includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

// act as the first user
global $user;
$user = user_load(1);
// add your custom code here

You will need to tweak this to your specific needs. Place it outside your site root for security reasons.

  • Hahah nice. Will absolute try that ! – Justme May 10 '18 at 16:52
0

Upload drush.phar to your web host and then you can execute the phar file in php:

php ~/path_to_the_drush_binary/drush.phar

You'll find the drush.phar file on https://github.com/drush-ops/drush/releases, the latest drush 8 version is https://github.com/drush-ops/drush/releases/download/8.1.16/drush.phar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.