Drush command(s) run on Drupal 6 sites, but not Drupal 7? - php

I am running into an issue with a customer's Drupal sites. He has a number of D6 installs, and a new D7 that he's just starting on. All of these sites are on the same shared hosting package.
The problem is when running certain drush commands only on the D7 site. There are no issues on the D6 sites. The specific error for drush up on the D7 site follows:
foo#bar [~/www/foo]# drush up
Command pm-update needs a higher bootstrap level to run - you will need to invoke drush [error]
from a more functional Drupal environment to run this command.
Command pm-update needs the following modules installed/enabled to run: update. [error]
The drush command 'up' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a configured database. In
this case you can select another site with a working database setup by specifying the URI
to use with the --uri parameter on the command line. See `drush topic docs-aliases` for
details.
* connect the database through a socket. The socket file may be wrong or the php-cli may
have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.
Drush was attempting to connect to:
Drupal version : 7.28
Site URI : http://default
Database driver : mysql
Database username : username_foo
Database name : database_foo
PHP configuration :
PHP OS : Linux
Drush version : 7.0-dev
Drush temp directory : /tmp
Drush configuration :
Drush alias files :
Drupal root : /home/foo/www/foo
Site path : sites/default
Everything I can find (and indeed the link in the error message) say the solution is to change the host value in the settings.php file from localhost to 127.0.0.1. However, this has not been the solution for us.
The frontend site has no problems connecting to the database, and drush itself seemingly does in many cases too.
drush sql-connect will generate a string that you can use to connect to MySQL.
drush sql-cli will successfully connect to MySQL
The settings.php file is definitely in a folder called default (path: www/foo/sites/default) and I get the exact same error when specifying --root and --uri options.
Drush was originally a ~5.x release, and it had the same issues. We updated to the ~7.x to try to eliminate the error. The host value in settings.php has been localhost as well as 127.0.0.1 with equally poor results.
We've verified that MySQL is available via socket from the PHP CLI. Drush is up to date and a fresh install. The Drupal 7 site is a brand new fresh install.
I'm at a loss. Why would this work with the D6 sites, but not the D7? Any suggestions?

Is your settings.php file in a folder called 'default'? If not, you might need to tell Drush where to find it by using --uri=mysite.com or -l mysite.com.
There are several ways to specify which Drupal site Drush will target. The most basic option is fairly verbose; run:
$ drush --root=/path/to/drupal --uri=http://example.com status
You can do the same thing with a slightly different syntax:
$ drush /path/to/drupal#example.com status
You can also specify the Drupal site implicitly, by setting the cwd to the folder that contains the settings.php file for your site:
cd /path/to/drupal/sites/default # or /path/to/drupal/sites/mysite.com, as appropriate
$ drush status
In all of the cases above, if settings.php is in a folder called "default", then you do not need to specify the --uri component; you may, for example, cd /path/to/drupal followed by drush status, and the correct Drupal site will be found. If settings.php is not in a folder named 'default', then you will need to either specify --uri, or cd to the folder that contains the settings.php file.
Source

According to this message:
pm-update needs the following modules installed/enabled to run: update
Drush requires Update module to be enabled, so the following command should fix the problem:
drush -y en update

Related

Where Drush 9 aliases file should be located in Drupal 8?

I have tried some ways to create an alias for my local Drupal project, I'm referring to :
https://www.drupal.org/node/1401522
https://www.drupal.org/project/drush/issues/831272
https://www.drupal.org/project/drush/issues/786766
I can connect by running this command :
drush --root=C:/wamp64/www/executive-coatings --uri=http://localhost:81/executive-coatings status
Output :
Drupal version : 8.6.13
Site URI : http://localhost:81/executive-coatings
DB driver : mysql
DB hostname : localhost
DB port : 3306
DB username : root
DB name : dev_ecc_new
Database : Connected
Drupal bootstrap : Successful
Default theme : ecc_front
Admin theme : adminimal_theme
PHP binary : C:\wamp64\bin\php\php7.2.10\php.exe
PHP config : C:\wamp64\bin\php\php7.2.10\php.ini
PHP OS : WINNT
Drush script : C:\wamp64\www\executive-coatings\vendor\bin\drush.phar
Drush version : 9.6.2
Drush temp : C:\Users\k\AppData\Local\Temp
Drush configs : C:/Users/k/.drush/drush.yml
C:/wamp64/www/executive-coatings/vendor/drush/drush/drush.yml
Install profile : minimal
Drupal root : C:\wamp64\www\executive-coatings
Site path : sites/default
Files, Public : sites/default/files
Files, Temp : /tmp
But when I try to use a drush alias it doesn't work. Here my alias file :
$aliases['local'] = array(
'uri' => 'localhost:81/executive-coatings',
'root' => 'C:/wamp64/www/executive-coatings',
'path-aliases' => array(
'%dump-dir' => '/tmp',
),
);
Running drush #local status returns [preflight] The alias #local could not be found.
I think I put my alias file in the wrong directory, can you provide the correct path ?
Alias file location is not your only issue here, because you are running Drush 9.x. Here the major changes between Drush 8.x and Drush 9.x regarding aliases :
Site aliases are no longer PHP files but YAML files. Hopefully Drush 9.x comes with a command to convert your old drush 8 aliases :
drush site:alias-convert
The user alias locations used in Drush 8 (~/.drush/sites, /etc/drush/sites) are by default no longer parsed, but you can register any location where alias files may be placed in your ~/.drush/drush.yml configuration file. Setting the old Drush 8 paths can be done automatically by running :
drush core:init
It writes the following to ~/.drush/drush.yml :
drush:
paths:
alias-path:
- '${env.home}/.drush/sites'
- /etc/drush/sites
For example in your case, defining a local environment for the website executive-coatings aliased ecc may be done in the file (provided this location is registered as mentioned above) ~/.drush/sites/ecc.site.yml.
You can also define environment aliases (eg. #dev, #preprod, etc.) for a given website at the following location (under the project root of that website, using self in the file naming) :
<DRUPAL_ROOT>/drush/sites/self.site.yml
Useful links :
- https://github.com/drush-ops/drush/blob/master/examples/example.site.yml
- https://github.com/consolidation/site-alias

Running Rscript from within PHP: cannot load shared libraries

I am trying to run R code from within PHP. I am using RHEL 7.4.
However, because Apache runs as a different user than installed the R packages, it cannot load packages:
My PHP code has this line:
echo shell_exec("(Rscript -e 'library(lme4, lib.loc = \"/var/www/R/lib\")')2>&1");
which produces this error in the browser:
Error: package or namespace load failed for 'lme4' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/var/www/R/lib/Rcpp/libs/Rcpp.so':
/var/www/R/lib/Rcpp/libs/Rcpp.so: failed to map segment from shared object: Permission denied
Execution halted
The file /var/www/R/lib/Rcpp/libs/Rcpp.so has permissions 775, so I don't think the permissions are actually the problem.
How can I tell Apache / PHP where to look for the shared libraries?
The server is not public-facing, so I would take any solution from properly accessing the shared library, to giving user apache sudo access with NOPASSWD to run as my user (or something similarly reckless, since that didn't actually work...).
Thank you!
This appears due in part to an SELinux setting in Red Hat. I'm not entirely sure whether this is Red Hat-centric, or specific to the configuration at my university (who installed Red Hat in the first place).
Originally:
$ getenforce
Enforcing
Fix:
$ sudo setenforce 0
$ getenforce
Permissive
Persistent fix: modify /etc/selinux/config to have the line
SELINUX=Permissive
Credit to this StackOverflow thread.

Vesta CP and RoundCube Mail database error

Hello all i am having a vps server with vesta installes but i am having database connection error with roundcube here ..
I read this article https://forum.vestacp.com/viewtopic.php?t=4375
and helped me to understand the issue
And the solution is
This issue appeared for me because roundcubemail wasn't fully installed and configured during the Vesta install process. To get it working I needed to set the following line to true instead of false in /etc/roundcubemail/main.inc.php:
CODE: SELECT ALL
$rcmail_config['enable_installer'] = false;
Then run the roundcubemail installer by going to http://domain.org/webmail/installer/
And to complete the installer successfully after I got to the point that it complained that I had no readable config.inc.php I needed to copy the config.inc.php the installer generated into /etc/roundcubemail/ and set that file to the same readability as the other config files in that directory and then set the same option:
CODE: SELECT ALL
$rcmail_config['enable_installer'] = false;
once again to true, but in the new file config.inc.php rather than /etc/roundcubemail/main.inc.php.
The installation then completed correctly and at that point I set the enable_installer lines I referenced above back to false in both
/etc/roundcubemail/main.inc.php
and in /etc/roundcubemail/config.inc.php so that they would no longer be in installer mode. Not sure if this is a Vesta bug – my understanding was that dependencies like Roundcubemail would be completely installed and configured in the Vesta install process but maybe that's incorrect.
but i dont know how to access the etc folder from my server by ssh
As when i login i only see thse when ls
f.txt login.info vst-install-rhel.sh vst-install.sh vst_install_backups
and when entered into vst_install_backups i get these
clamd dovecot exim httpd mongodb mysql named nginx php php-fpm postgresql proftpd spamassassin vesta vsftpd
Please help me solve the roundcube and vesta issue ..
I have just same problem. I have solved it by next steps:
1) Login in phpmyadmin under root (password for root should be same as for vesta).
2) Create database roundcube
3) Create user roundcube with privilegies
CREATE USER 'roundcube'#'localhost';
SET PASSWORD FOR roundcube#localhost = PASSWORD('<password>');
GRANT ALL PRIVILEGES ON roundcube.* TO roundcube#localhost;
you can find password there: /etc/roundcube/db.inc.php
4) Login by ssh to the server and run script:
mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
This is sql from installation of vesta

apache - additional mysql-installation without root

got some space at an intern SUSE Linux Enterprise Server 11 (x86_64) for the apache-webserver (apache 2.2.29, php 5.4.40) of our department.
Our php is built with Oracle, not MySQL. I wanna install MySQL additionally but due to our very strict guidelines I only have permissions to write in my "/usd/[user]"-directory, not "/var/lib" etc. so there is no possibility to run the command "rpm -i MySQL-server-5.6.25-1.sles11.x86_64.rpm" or sth like that.
user:/usd/as07100a/soft> rpm -i MySQL-server*
error: can't create transaction lock on /var/lib/rpm/__db.000
user:/usd/as07100a/soft> touch /var/lib/rpm/__db.000
touch: cannot touch `/var/lib/rpm/__db.000': Permission denied
Is there any known option I can install MySQL with my restricted permissions (e. g. kinda portable version)?
It seems that this is possible:
Install MySql without root access
Also see this post for additional configuration information: Mysql - specify socket location
You will also likely need to change the port number in your configuration since OracleSQL is probably running on that port already. You can use netstat to see if any other program is listening on 3306.
netstat -ntl

phabricator on redhat's openshift

I installed phabricator on openshift using a quickstart from github
https://github.com/CodeBlock/phabricator-openshift-quickstart
I got it running up fine, but I now have two issues:
1.) A setup issue that says apc.stat is enabled and that must be disabled in
/var/lib/openshift/my-user-hash/php/configuration/etc/php.ini
however I cannot access that with sudo command(sudo permission denied), even if I open it normally, I didn't find any apc.stat settings in the php.ini
2.) I can't figure out how set the local path for tracking repositories for diffusion. It says
I must give a path which should be read-writable by phabricator, I tried to give the persistent storage location ..data/ , but it gives me an exception as follows :
Unhandled Exception ("CommandException")
Command failed with error #1!
COMMAND
(cd '../data/' && HOME='/var/lib/openshift/my-user-hash/app-root/runtime/repo/phabricator/support/empty/' git cat-file --batch)
STDOUT
(empty)
STDERR
sh: line 0: cd: ../data/: No such file or directory
how do I fix this?
1) According to Num Duong answer, it seems like u currently could not resolve this issue, probably u should wait for openshift php.ini permissions policy changes.
Anyway this is minor non blocking issue.
2) Modify config file and re-deploy to openshift.
Look for available phabricator options here
U need smth like this: 'repository.default-local-path' => getenv('OPENSHIFT_DATA_DIR'),
P.S. Anyway there is one particular issue with phabricator on openshift that possibly never got resolved: cloning git repositories from OpenShift instances into Phabricator do not
work by SSH, due to permissions regarding the ssh configuration.

Categories