Download & Extend

Drush Incompatible With Secure Pages Module

Project:Drush
Version:All-versions-5.x-dev
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

Clean download of drush results in the following errors:

exampledotcom@server1:~/web $ drush status
Drush command could not be completed.                                [error]

Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /home/exampledotcom/web/includes/database.mysqli.inc on line 323

Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /home/exampledotcom/web/includes/database.mysqli.inc on line 323

Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /home/exampledotcom/web/includes/database.mysqli.inc on line 323

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/exampledotcom/web/includes/database.mysqli.inc on line 108

Warning: mysqli_errno() expects parameter 1 to be mysqli, null given in /home/exampledotcom/web/includes/database.mysqli.inc on line 122

Warning: mysqli_affected_rows() expects parameter 1 to be mysqli, null given in /home/exampledotcom/web/includes/database.mysqli.inc on line 200
exampledotcom@server1:~/web $

This is a fairly new D6.12 install. Everything else on the site works fine. Please let me know if there's anything else I should be looking at.

Comments

#1

Status:active» postponed (maintainer needs more info)

perhap pass in --root and --uri params. also add --debug to see more messages.

#2

Status:postponed (maintainer needs more info)» closed (fixed)

please reopen if needed.

#3

Status:closed (fixed)» active

Sorry for not getting back to you sooner.

exampledotcom@server1:~/web $ drush --root=/home/exampledotcom/web/ --uri=http://www.example.com/ --debug status
Found command: status [0.016 sec]                                    [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.016 sec]   [bootstrap]
Initialized Drupal 6.12 root directory at                               [notice]
/home/exampledotcom/web/ [0.024 sec]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.024 sec]   [bootstrap]
Initialized Drupal site www.example.com at sites/default        [notice]
[0.031 sec]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration()      [bootstrap]
[0.031 sec]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.034    [bootstrap]
sec]
Successfully connected to the Drupal database. [0.034 sec]           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.04 sec]    [bootstrap]
session_start(): Cannot send session cookie - headers already sent by[warning]
(output started at
/home/exampledotcom/drush/includes/drush.inc:439) [0.041 sec]
session_start(): Cannot send session cache limiter - headers already [warning]
sent (output started at
/home/exampledotcom/drush/includes/drush.inc:439) [0.041 sec]
Cannot modify header information - headers already sent by (output   [warning]
started at /home/exampledotcom/drush/includes/drush.inc:439)
[0.053 sec]
Drush command could not be completed. [0.055 sec]                    [error]
mysqli_real_escape_string() expects parameter 1 to be mysqli, null   [warning]
given [0.055 sec]
mysqli_real_escape_string() expects parameter 1 to be mysqli, null   [warning]
given [0.055 sec]
mysqli_real_escape_string() expects parameter 1 to be mysqli, null   [warning]
given [0.055 sec]
mysqli_query() expects parameter 1 to be mysqli, null given [0.055   [warning]
sec]
mysqli_errno() expects parameter 1 to be mysqli, null given [0.055   [warning]
sec]
mysqli_affected_rows() expects parameter 1 to be mysqli, null given  [warning]
[0.055 sec]
exampledotcom@server1:~/web $ drush --root=/home/exampledotcom/web/ --uri=http://example.com/ --debug status
Found command: status [0.018 sec]                                    [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.018 sec]   [bootstrap]
Initialized Drupal 6.12 root directory at                               [notice]
/home/exampledotcom/web/ [0.027 sec]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.027 sec]   [bootstrap]
Initialized Drupal site example.com at sites/default [0.034     [notice]
sec]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration()      [bootstrap]
[0.034 sec]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.037    [bootstrap]
sec]
Successfully connected to the Drupal database. [0.037 sec]           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.043 sec]   [bootstrap]
session_start(): Cannot send session cookie - headers already sent by[warning]
(output started at
/home/exampledotcom/drush/includes/drush.inc:439) [0.044 sec]
session_start(): Cannot send session cache limiter - headers already [warning]
sent (output started at
/home/exampledotcom/drush/includes/drush.inc:439) [0.044 sec]
Cannot modify header information - headers already sent by (output   [warning]
started at /home/exampledotcom/drush/includes/drush.inc:439)
[0.085 sec]
Drush command could not be completed. [0.086 sec]                    [error]
mysqli_real_escape_string() expects parameter 1 to be mysqli, null   [warning]
given [0.086 sec]
mysqli_real_escape_string() expects parameter 1 to be mysqli, null   [warning]
given [0.086 sec]
mysqli_real_escape_string() expects parameter 1 to be mysqli, null   [warning]
given [0.086 sec]
mysqli_query() expects parameter 1 to be mysqli, null given [0.086   [warning]
sec]
mysqli_errno() expects parameter 1 to be mysqli, null given [0.086   [warning]
sec]
mysqli_affected_rows() expects parameter 1 to be mysqli, null given  [warning]
[0.086 sec]
exampledotcom@server1:~/web $

This user has a several other sites that it has access to and drush works just fine on them.

exampledotcom@server1:~/web $ cd ../staging/stagingsite1/
exampledotcom@server1:~/staging/stagingsite1 $ drush status
  PHP configuration : /etc/php5/cli/php.ini
  Drupal Root       : /home/exampledotcom/staging/stagingsite1
  Drupal version    : 6.12
  Site Path         : sites/default
  Site URI          : http://default
  Database Driver   : mysql
  Database Hostname : server2.example.com
  Database Username : stagingsite1
  Database Name     : stagingsite1
  Database Password : ------------
  Database          : Connected
  Drupal Bootstrap  : Successful
  Drupal User       : Anonymous
exampledotcom@server1:~/staging/stagingsite1 $

#4

I had this exact same problem, and seem to have just fought my way out of it.

This happened to me with secure_pages enabled. Since secure_pages tries to redirect everything to the https version, it probably drives drush crazy. I think that's what happened to me.

To disable secure_pages I had to go to the system table in the database and set status=0:

update system set status=0 where name="securepages";

#5

You should be able to fix this (without disabling the module in the database) this by adding the following to your drushrc.php file:
$conf = array(
'securepages_enable' => FALSE,
);

I add this to be settings.php on sandboxes for sites that use securepages module.

#6

@Owen Barton - Thanks for the tip (#5). Just to clarify - Do you add it to settings.php or to drushrc.php?

#7

@rfey - I add it to settings.php on my sandbox (since my sandbox is normally not set up with SSL), in which case adding it to drushrc.php is redundant.

If you use drush on a server where you actually want securepages enabled via the web interface, then you will need to add it to drushrc.php (since you can't add it to settings.php for obvious reasons).

#8

Yes, the secure pages module is the problem. However, adding that code to my drushrc.php file doesn't help. I added it below the "variable overrides" section.

#9

Title:Various mysqli_real_escape_string and mysqli_query errors» Drush Incompatible With Secure Pages Module

#10

Status:active» closed (duplicate)

I am flagging this issue as duplicate of #578448: $override in drushrc.php does not work because it gets re-initialized in DRUPAL_BOOTSTRAP_CONFIGURATION.

I got to this issue because of the same SecurePages problem but eventually this is not really a drush issue. I tried to use drushrc.php but it won't work, and I found a problem related to the $override in drush which I reported and submitted a patch in the duplicate issue.

#11

#12

Thanks for your work guys - but has anyone got this to work with secure pages ok?

I've installed the lastest Drush - applied the patch from #578448 , and am calling drush with drushrc.php configured as suggested - and still getting the mysqli_real_escape issue...

Have I missed anything?

#13

Great.

<?php
$override
= array(
 
'securepages_enable' => FALSE, // Disable securepages module, if present, as it interferes with drush.
);
?>

Adding this in drushrc.php fixed my problems.

#14

Subscribing...

#15

Adding the code specified in #5 and #13 fixed it for me too!

Thanks Owen, Thanks Jody!

#16

See also #599948: conflict with drush (headers already sent) for drush/securepages compatibility.

#17

Component:Code» PM (dl, en, up ...)

I added the following to my drushrc.php file (in root of Drupal site), and it works just as well as adding it in settings.php (better, for me, since I need to run drush on a production server, and drushrc doesn't conflict with the live settings.php):

<?php
$override
= array(
 
'cache_inc' => 'includes/cache.inc', // to disable memcache
 
'securepages_enable' => FALSE, // to disable securepages
);
?>

#18

Component:PM (dl, en, up ...)» Miscellaneous

Umm... components must've been edited since last post.

nobody click here