Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Stephen Winters on
Hi,
Could someone help me to get Drush working
I am installing Drush using PUTTY on a Semi-Dedicated Basic hosting account. I was able to install Drush using PUTTY, but with some warnings. I also tried to update a test Drupal site, but it didn't work. I copied the log of both actions below.
I used these instructions to install DRUSH: Installing Drush On Any Linux Based Server Out There
What my server includes:
mylogin@mycpanel.com [~]# uname -a
Linux sds3.linuxhostingserver.com 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 17 01 :55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
mylogin@mycpanel.com [~]# lsb_release -a
-jailshell: lsb_release: command not found
mylogin@mycpanel.com [~]# cat /etc/*release
cat: /etc/*release: No such file or directory
mylogin@mycpanel.com [~]# cat /etc/issue*
cat: /etc/issue*: No such file or directory
mylogin@mycpanel.com [~]# cat /proc/version
Linux version 2.6.32-504.3.3.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gc c version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Dec 17 01:55:02 U TC 2014
mylogin@mycpanel.com [~]# pear version
PEAR Version: 1.9.5
PHP Version: 5.4.42
Zend Engine Version: 2.4.0
Running on: Linux sds3.linuxhostingserver.com 2.6.32-504.3.3.el6.x86_64 #1 SMP W ed Dec 17 01:55:02 UTC 2014 x86_64
mylogin@mycpanel.com [~]# pear channel-discover pear.drush.org
Adding Channel "pear.drush.org" succeeded
Discovery of channel "pear.drush.org" succeeded
Log of Drush Install
mylogin@mycpanel.com [~]# pear install drush/drush
Warning: popen() has been disabled for security reasons in Guess.php on line 242
Warning: fgets() expects parameter 1 to be resource, null given in Guess.php on line 243
Warning: pclose() expects parameter 1 to be resource, null given in Guess.php on line 252
downloading drush-6.2.0.0.tgz ...
Starting to download drush-6.2.0.0.tgz (505,989 bytes)
.............................done: 505,989 bytes
install ok: channel://pear.drush.org/drush-6.2.0.0
mylogin@mycpanel.com [~]#
Log of an attempted Drupal Update using Drush
mylogin@mycpanel.com [~/public_html/drupaltestsite]# drush up
exec() has been disabled for security reasons bootstrap.inc:638 [warning]
The following restricted PHP modes have non-empty values: [error]
disable_functions. This configuration is incompatible with drush.
Please check your configuration settings in /usr/local/lib/php.ini or
in your drush.ini file; see examples/example.drush.ini for details.
exec() has been disabled for security reasons exec.inc:150 [warning]
exec() has been disabled for security reasons exec.inc:150 [warning]
exec() has been disabled for security reasons exec.inc:150 [warning]
unlink(/home/mylogin/php/drush/lib/package.xml): No such file or [warning]
directory drush.inc:691
The drush command 'up' could not be found. Run `drush cache-clear [error]
drush` to clear the commandfile cache if you have installed new
extensions.
Drush needs a copy of the PEAR Console_Table library in order to [error]
function, and the attempt to download this file automatically failed.
To continue you will need to download the 1.1.3 package from
http://pear.php.net/package/Console_Table, extract it into
/home/mylogin/php/drush/lib directory, such that Table.php exists at
/home/mylogin/php/drush/lib/Console_Table-1.1.3/Table.php.
mylogin@mycpanel.com [~/public_html/drupaltestsite]#
Can you tell me what I need to do to get DRUSH operating properly?
Best Wishes,
Stephen
Comments
In the log of the attempted
In the log of the attempted Drupal Update (in previous message) I saw these instructions:
So I went to this location:
http://pear.php.net/package/Console_Table/download/1.1.3
and I saw and used this code:
Easy Install
pear install Console_Table-1.1.3
Attempted Table Installion
Here is the log of my attempted table installation.
Best Wishes,
Stephen
Tried Drush Update again
Tried Drush Update again
I saw that the attempted table installation had some warning messages in the log. But, I thought I would try a Drush update again to see if it would work. This is a log of that attempted update.
Manually Installed Table
Since the log said that I need to manually install the table, I went to this location: http://pear.php.net/package/Console_Table and downloaded the 1.1.3 table. I then went into my Cpanel and uploaded the table zip file to /home/mylogin/php/drush/lib/ and extraced the file into that location. Then I attempted to clear the Drush cache, as shown in the log below. (I got interrupted yesterday morning in the middle of this and had to come back to this morning (1:43 am), so I'm not sure if I remember everything I did, have included the log anyway.
Morning Check
This morning I went into my Cpanel files section and verified that the table is located at: /home/mylogin/php/drush/lib/Console_Table-1.1.3/Table.php.
Now, to check the situation this morning, I cleared the drush cache and I also attempted a drush update so that I could get a current log printout:
Cleared Drush Cache
Attempted Drush Update
Stephen
Where is the usr folder?
Where is the usr folder?
In the log I see these instructions:
I have looked all through the cPanel files section and can not find the "usr" folder, in which the php.ini file is supposed to be located. However, in looking through the Drush Status report (below) I see that there is a usr folder listed by PHP executable AND PHP configuration. Yet, I still haven't found it. I need to find it so that I can check my configuration settings.
Drush Status
This morning I discovered the Drush Status command.
Stephen
I don't know much about the
I don't know much about the cPanel shell, but it looks like you'd have to edit the PHP configuration file to get drush running properly. It's probably rather a question for your hoster, if the php.ini can be edited and if so how.
I could imagine that they restrict access to that file in that shared environment and that you can't do much about it.
I like cookies!
More Research
Stefan, thanks for you input. I'm a little hesitant to contact the web host because, at this point, I don't know what I'd ask them to do. Because they are an India based company I have to be very specific in what I say to them, otherwise they don't understand. So, before I contact the web host I thought I'd do a little more research and see what I can figure out.
In doing more research I ran across this web page: [SOLVED] [HOWTO] How to install Drush via PHP PEAR on your cPanel/WHM shared hosting server account On the page I found a link to this page: http://www.6by9.net/drush-on-an-hosting-fix-using-custom-php-ini/ .
On that page
"The fix is easy – you simply have to give drush its own php.ini file with looser security. The benefit here is that the Apache web server will run PHP in a more locked-down mode, but drush will operate with full permissions. SSH into your server and run the following commands:"
Using PUTTY in my home directory I entered the above code. Then, to see if it changed anything, I again entered a Drush Status command:
Add New php.ini and Compare Drush Status
In comparing the above Drush Status readout and the previous one I see that most of the errors remained. However, one thing that I see that did change was that a new php.ini file location has been added:
PHP configuration : /usr/local/lib/php.ini
to
PHP configuration : /home/mylogin/.drush/php.ini
That puts the php.ini file in a position that I can access it. I don't have time to do anything else this morning, but I'll look again when I get back to this.
Stephen
Editing php.ini -SUCCESS!!!
Now that I have a php.ini file located where I can find it "/home/mylogin/.drush/php.ini" I opened the file in my cpanel editor. I followed the below instructions, found on the linked page:
http://www.6by9.net/drush-on-an-hosting-fix-using-custom-php-ini/
On line 188 in the php.ini file I found this text
disable_functions = "show_source, system, passthru, exec, popen, proc_open, allow_url_fopen"
I deleted everything on the right, so the line now looks like this:
disable_functions =
Then I saved the php.ini file.
Checked Drush Status again
I then logged back in with PUTTY and entered "Drush Status" and this is what is showed
It looks incouraging, no error codes.
Another Test Drush Update
Now I navigated to my test website and did a Drush Update
SUCCESS, YEAH!!!!!
I finally should now be able to do the quick Drush updates on my sister's websites!!!
Stephen
Nice. Thumbs up! :-)
Nice. Thumbs up! :-)
I like cookies!
It works, but...
Great solution, Stephen Winters, good work! But some clarification and some mystery.
Since I already have a ".drush" directory, I used ssh and bash to run
cp -i /usr/local/lib/php.ini ~/.drush/
and saw that line 188 of this new php.ini read "disable_functions =“. In other words, no functions are disabled there or in the /usr/ version.When I then ran
drush upc
it worked with no warnings, but my site crashed: misconfigured somehow. To fix this I copied ".htaccess” from the backup drush had created. That got the site working OK. Drupal Reports suggested that drupal core was updated to 7.38; that maybe Cron should be triggered manually right now; and that PHP is using /usr/local/lib/php.ini .My service provider Daily Razor said they use PHP extensions (“SLOG”, prohibiting "*exec|popen|system|passthru”; however, the Drush script is not using PHP’s “exec” but is calling "exec" via the bash shell. Oddly,
drush ups
produced a bunch of warnings that begin “slog_exec(): Access to function exec is denied exec.inc:150". I immediately diddrush status
and was rewarded with a satisfactory response. I then immediately again diddrush ups
and it worked with no warnings. Go figure! Somehow the shell manages to do its thing intermittently.For me, the take-home is
Hope this helps someone.