I'm running: Drupal 7.34, PHP 5.4.16, MySQL 15.1 Distrib 5.5.41-MariaDB, for Linux  I am getting a WSOD on just the module page after a move of server, everything else seems to be running ok.  I've added:  error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);   to index.php and see the below errors:     Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /public_html/includes/database/database.inc:2171 Stack trace:      #0 /public_html/includes/database/database.inc(2171): PDOStatement->execute(Array)      #1 /public_html/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)      #2 /public_html/includes/database/database.inc(2350): DatabaseConnection->query('SELECT expire, ...', Array, Array)      #3 /public_html/includes/lock.inc(167): db_query('SELECT expire, ...', Array)      #4 /public_html/includes/lock.inc(146): lock_may_be_available('theme_registry:...')      #5 /public_html/includes/theme.inc(449): lock_acquire('theme_registry:...')      #6 /public_html/includes/bootstrap.inc(455): ThemeRegistry->set(Array) #7 [internal function]:      DrupalCacheArray->__destruct()     #8 {main} thrown in /public_html/includes/database/database.inc on line 2171      Fatal error: Access to undeclared static property: Database::$activeKey in /public_html/includes/database/database.inc on line 1466
39135
I have a site at hostgator, using their "Business account". It's cheap, and comes with a private SSL cert. HOWEVER, their MySQL settings are such that any db connection goes stale fairly quickly, and then the hostgator staff try to convince you to use a VPS or dedicated server at multiple times the expense.  I'm creating and deploying WebAPIs, which can have a 'conversation' which exceeds 60 seconds. When this occurs, the db connection handle is stale, causing any db operations after my timeout to fail.  I'm in the process of implementing the following solution, but am curious if anyone else has solved this issue (where they can not modify their my.ini or my.cnf to give MySQL more resources) in a similar or completely different manner.  last part of a hook_update:  $ret = db_query( "UPDATE {my_table} set field1 = '%s', field2 = %d ... WHERE vid - %d", $node-&gt;field1, $node-&gt;field2, ... $node-&gt;vid ); if (!$ret) {        // get private storage directory for this node:        $cexStorage    = _cex_front_getCexStore();        $nodeFilesPath = DRUPALROOT.'/'.$cexStorage.'/'.$node-&gt;storeDir;        $fname         = $nodeFilesPath.'/recover.node';         $readyToWrite  = serialize( $node );        file_put_contents( $fname, $readyToWrite );        if (file_exists( $fname )) {          _dbgReport( 'seems to have worked!' );        }     }   Then this is called in my hook_form, right after I determine that node->nid is valid:  function _cex_front_recover_node( &amp;$node ) {   if (!isset($node-&gt;storeDir)) {      _dbgReport( '**************************** _cex_front_recover_node: no storeDir!!!' );      return;   }    // get private storage directory for this node:   $cexStorage    = _cex_front_getCexStore();   $nodeFilesPath = DRUPALROOT.'/'.$cexStorage.'/'.$node-&gt;storeDir;   $fname         = $nodeFilesPath.'/recover.node';   if (file_exists( $fname )) {     $recovered = file_get_contents( $fname );     if ($recovered) {       // no longer needed:       unlink( $fname );       $recoveredNode = unserialize( $recovered );       // restore the key values I need to proceed with this node:       $node-&gt;stage = $recoveredNode-&gt;stage;       $node-&gt;rnid  = $recoveredNode-&gt;rnid;       $node-&gt;iris  = $recoveredNode-&gt;iris;       cex_front_update( $node );     }     else {       _dbgReport( '********* failed to read "'.$fname.'"' );     }   } }   I'll be pairing the logic down to only store the key fields I need, but this works! Sure beats upgrading my server at 3x the expense. Anyone else doing something like this?
11903
I'm currently working on a WordPress site and whenever in the admin I go the Appearance > Menus page I get the following error:     ErrorException: Runtime Notice: Declaration of Walker_Nav_Menu_Edit::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl() in wp-admin/includes/nav-menu.php line 203   It seems like some sort of PHP compatibility issue. I'm running PHP 5.3.10 on my local dev machine.  What would be the best way to remedy this problem?
6130
In my custom Drupal 8 plug-in I perform such query:  $select = db_select('my_table', 'e'); $select-&gt;addField('e', 'field1');  $select-&gt;condition('field3', 'NULL', '!='); $select-&gt;condition('field4', array(11, 12, 31, 32, 33), 'IN');  $select-&gt;groupBy("e.field1"); $select-&gt;orderBy("e.field1"); $select-&gt;orderBy("e.field5"); $entries = $select-&gt;execute()-&gt;fetchAll(\PDO::FETCH_ASSOC);    And it works fine. It returns me all records grouped by field1 that meets the condition, orderered. But it returns only field1 column.  I wanted to get more columns, so I have added another $select-&gt;addField('e', 'field2'); just after first one:  $select = db_select('my_table', 'e'); $select-&gt;addField('e', 'field1'); $select-&gt;addField('e', 'field2');  $select-&gt;condition('field3', 'NULL', '!='); $select-&gt;condition('field4', array(11, 12, 31, 32, 33), 'IN');  $select-&gt;groupBy("e.field1"); $select-&gt;orderBy("e.field1"); $select-&gt;orderBy("e.field5"); $entries = $select-&gt;execute()-&gt;fetchAll(\PDO::FETCH_ASSOC);    This time I get error:     Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1055 Użyto 'my_database.e.field2' bez umieszczenia w group by:   Which means "my_database.e.field2 has been used without putting in into group by". But I don't want to group by every column I select.  Unfortunatelly Drupal 8 added ONLY_FULL_GROUP_BY :( Then, how can I use groupBy and select more then one column at the same time?
103021
I recently tried to move my Drupal site to a new server using this page: . But now the style doesn't seem be loaded and more importantly I get this error on every page in the site (even on the frontpage):  Warning: file_put_contents(temporary://filef76T9k): failed to open stream: &quot;DrupalTemporaryStreamWrapper::stream_open&quot; call failed in file_unmanaged_save_data() (line 1900 of /Library/Server/Web/Data/Sites/Default/drupal/includes/file.inc). The file could not be created.  Any ideas what this could be about?
42684
I know there is a question  but I checked its answers and it didn't help. I'm just learning developing modules for Drupal so maybe it's something really stupid but I have no idea...  My hook (in testModule4.install):  function testModule4_update_7001() {  $schema['testModule4_table'] = array(     'description' =&gt; 'TODO: Description',     'fields' =&gt; array(         'main_id' =&gt; array(             'description' =&gt; 'TODO: Description.',             'type' =&gt; 'serial',             'not null' =&gt; TRUE,         ),         'settings' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'text',             'not null' =&gt; FALSE,         ),         'uid' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'int',             'not null' =&gt; FALSE,         ),         'created' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'int',             'not null' =&gt; FALSE,         ),         'changed' =&gt; array(             'description' =&gt; 'TODO: Description',             'type' =&gt; 'int',             'not null' =&gt; FALSE,         ),     ),     'primary key' =&gt; array('main_id'), );  db_create_table('testModule4_table', $schema['testModule4_table']);  }   My module is working just fine. The schema_version of module in database is 0 but update.php just cannot see it. What can be the cause of that? :/ I was trying clearing cache and reenabling a module but without success. I just don't know where to search for source of the problem. If you need more data, just comment :/ .  Edit:  I created simple module:  testModule.module:  &lt;?php   function testModule_myform($delta = "") {      $form['something'] = array(         '#type' =&gt; 'markup',         '#markup' =&gt; 'Something',     );     return $form; }    /**  * Implements hook_menu();  */  function testModule_menu() {     $items["test/test"] = array(         'title' =&gt; 'testModule',         'description' =&gt; 'TODO: Description',         'page callback' =&gt; 'drupal_get_form',         'page arguments' =&gt; array('testModule_myform'),         'access callback' =&gt; TRUE,      );     return $items; }   testModule.info:  name = testModule description = Test module for Drupal experiments. package = CustomTest core = 7.x   testModule.install:  function testModule_update_7001() {     drupal_set_message('It works!');     print 'Show something!'; }   And it still ignores this hook... Is it officially a Drupal bug and I need to reinstall the whole Drupal? >_&lt;
74983
I'm writing a php app to access a MySQL database, and on a tutorial, it says something of the form  mysql_connect($host, $user, $pass) or die("could not connect");   How does PHP know that the function failed so that it runs the die part? I guess I'm asking how the "or" part of it works. I don't think I've seen it before.
112412
WAMP installed fine, no problems, BUT...  When going to phpMyAdmin, I get the error from phpMyAdmin as follows:  Cannot load mysqli extension. Please check your PHP configuration   Also, phpMyAdmin documentation explains this error message as follows:     To connect to a MySQL server, PHP needs a set of MySQL functions   called "MySQL extension". This extension may be part of the PHP   distribution (compiled-in), otherwise it needs to be loaded   dynamically. Its name is probably mysql.so or php_mysql.dll.   phpMyAdmin tried to load the extension but failed. Usually, the   problem is solved by installing a software package called "PHP-MySQL"   or something similar.   Finally, the apache_error.log file has the following PHP warnings (see the mySQL warning):  PHP Warning: Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0 PHP Warning: Zend Platform does not support this version of PHP - please upgrade to the latest version of Zend Platform in Unknown on line 0 PHP Warning: Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0 PHP Warning: gd wrapper does not support this version of PHP - please upgrade to the latest version of gd wrapper in Unknown on line 0 PHP Warning: java wrapper does not support this version of PHP - please upgrade to the latest version of java wrapper in Unknown on line 0 PHP Warning: mysql wrapper does not support this version of PHP - please upgrade to the latest version of mysql wrapper in Unknown on line 0   So, for some reason PHP is not recognizing the mysql extension.  Anyone know why? Any solution or workaround?
118672
I am totally new in linux/ubuntu I am trying to setup lamp on my OS, however I've installed apache , php , mysql by following commands:  sudo apt-get install apache2 sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql sudo apt-get install phpmyadmin   everything works fine except that i totally cannot log into MySQL(which leads to phpmyadmin failure login) getting the errors :   #1045 Cannot log in to the MySQL server Access denied for user 'root'@'localhost' (using password: YES)   I googled the problem and also I have tried to reinstall  all installed components, but the same result came up!   in windows i usually modified the content of mysql configure file but in ubuntu nothing is as same as windows!:)  can anybody help me on this, really need to setup lampp :-S  thanks in advanced
99904
I upgraded to mysql 5.6 from 5.5, and now my logs are littered with such messages on startup  I found a possible solution here, but it does not seem official.   2013-12-06 21:08:00 7f87b1d26700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found. 2013-12-06 21:08:00 7f87b1d26700 InnoDB: Recalculation of persistent statistics requested for table "drupal"."sessions" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead. 2013-12-06 21:08:07 7f903c09c700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.   Any official solutions or 100% fixes?
57387
I am attempting to upgrade my Drupal 8.9.2 multi-site installation to D9. I was hoping to work this all out on a development installation, that is located in a subdirectory of my home directory on my NameCheap Shared Hosting plan. When I first installed this installation, I did so using the tarball method from years ago. I then followed the instructions given here (). I was able to get the current running prod version converted to use composer with out an issue. Before I go and start messing with the files, and attempting to upgrade to D9 through composer on a prod installation, I wanted to copy these files over to another installation where I can use it as a sandbox. To do this I:  copied the files on my server to a new directory made clone databases for the new installation truncated all the cache tables in the cloned DB changed all the database settings in the settings files to point to the cloned databases  I've done this before without any issues, and now I seem to be getting a WSOD error on all the sites running from the new installation. The error I'm getting is  PHP Fatal error:  Uncaught Error: Class 'Drupal\Core\Cache\DatabaseBackend' not found in ~/{new installation dir}/public_html/index.php:16.  If anyone has any thoughts what's going on I am all ears. Thank you in advance
65216
I am dissecting some code and came across this,   $sql = 'SELECT page.*, author.name AS author, updator.name AS updator '      . 'FROM '.TABLE_PREFIX.'page AS page '      . 'LEFT JOIN '.TABLE_PREFIX.'user AS author ON author.id = page.created_by_id '      . 'LEFT JOIN '.TABLE_PREFIX.'user AS updator ON updator.id = page.updated_by_id '      . 'WHERE slug = ? AND parent_id = ? AND (status_id='.Page::STATUS_REVIEWED.' OR status_id='.Page::STATUS_PUBLISHED.' OR status_id='.Page::STATUS_HIDDEN.')';   I am wondering what the "?" does in the WHERE statement.  Is it some sort of parameter holder?
121999
I have installed Apache2 MariaDB and PHP7 for use on localhost, but PHP does not work. The Apache webside looks as normal while phpinfo.php only gives me a blank page. I used to install with 'apt-get install lamp-server^', but I wanted MariaDB, so I installed every single package including some PHP extensions and phpmyadmin. I have no idea of how to get php working. Any clues?   ~ # php -v PHP 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )   phpinfo.php:  &lt;? phpinfo(); ?&gt;
32303
I have previously saved a copy of /var/lib/mysql/ddms directory ("ddms" is the schema name). Now I installed a new MySQL on a freshly installed Ubuntu 10.04.3 LTS by running apt-get install mysql-server, I believe version 5.1 was installed. After I copy the ddms directory under /var/lib/mysql, some of its tables work fine, these are the tables with an associated set of three files: a .frm file, a .MYD file and a .MYI file.  However, there are two tables with a different set of files: a .frm file and a .ibd file. These two tables didn't show up in the table list in phpMyAdmin. When I look at the error log, it says:  [ERROR] Cannot find or open table ddms/dictionary_item from the internal data dictionary of InnoDB though the .frm file for the table exists. Maybe you have deleted and recreated InnoDB data files but have forgotten to delete the corresponding .frm files of InnoDB tables, or you have moved .frm files to another database? or, the table contains indexes that this version of the engine doesn't support.   Please help with restoring these two tables. Thanks.
46938
I am trying to execute my PHP code, which calls two MySQL queries via mysqli, and get the error "Commands out of sync; you can't run this command now".  Here is the code I am using  &lt;?php $con = mysqli_connect("localhost", "user", "password", "db"); if (!$con) {     echo "Can't connect to MySQL Server. Errorcode: %s\n". Mysqli_connect_error();     exit; } $con-&gt;query("SET NAMES 'utf8'"); $brand ="o"; $countQuery = "SELECT ARTICLE_NO FROM AUCTIONS WHERE upper(ARTICLE_NAME) LIKE % ? %"; if ($numRecords = $con-&gt;prepare($countQuery)) {     $numRecords-&gt;bind_param("s", $brand);     $numRecords-&gt;execute();     $data = $con-&gt;query($countQuery) or die(print_r($con-&gt;error));     $rowcount = $data-&gt;num_rows;     $rows = getRowsByArticleSearch("test", "Auctions", " ");     $last = ceil($rowcount/$page_rows); }  else {  print_r($con-&gt;error); } foreach ($rows as $row) {     $pk = $row['ARTICLE_NO'];     echo '&lt;tr&gt;' . "\n";     echo '&lt;td&gt;&lt;a href="#" onclick="updateByPk(\'Layer2\', \'' . $pk . '\')"&gt;'.$row['USERNAME'].'&lt;/a&gt;&lt;/td&gt;' . "\n";     echo '&lt;td&gt;&lt;a href="#" onclick="updateByPk(\'Layer2\', \'' . $pk . '\')"&gt;'.$row['shortDate'].'&lt;/a&gt;&lt;/td&gt;' . "\n";     echo '&lt;td&gt;&lt;a href="#" onclick="deleterec(\'Layer2\', \'' . $pk . '\')"&gt;DELETE RECORD&lt;/a&gt;&lt;/td&gt;' . "\n";     echo '&lt;/tr&gt;' . "\n"; } function getRowsByArticleSearch($searchString, $table, $max) {     $con = mysqli_connect("localhost", "user", "password", "db");     $recordsQuery = "SELECT ARTICLE_NO, USERNAME, ACCESSSTARTS, ARTICLE_NAME, date_format(str_to_date(ACCESSSTARTS, '%d/%m/%Y %k:%i:%s'), '%d %m %Y' ) AS shortDate FROM AUCTIONS WHERE upper(ARTICLE_NAME) LIKE '%?%' ORDER BY str_to_date(ACCESSSTARTS, '%d/%m/%Y %k:%i:%s')" . $max;     if ($getRecords = $con-&gt;prepare($recordsQuery)) {         $getRecords-&gt;bind_param("s", $searchString);         $getRecords-&gt;execute();         $getRecords-&gt;bind_result($ARTICLE_NO, $USERNAME, $ACCESSSTARTS, $ARTICLE_NAME, $shortDate);         while ($getRecords-&gt;fetch()) {             $result = $con-&gt;query($recordsQuery);             $rows = array();             while($row = $result-&gt;fetch_assoc()) {                 $rows[] = $row;             }             return $rows;         }     } }   I have tried reading up on this, but I am unsure of what to do. I have read about store result and free result, however these have made no difference when using them. I am unsure at exactly which point this error is being caused, and would like to know why it is being caused, and how to fix it.  Going by my debug statements, the first if loop for countQuery is not even being entered, because of an error in my sql syntax near near '% ? %'. However if I just select * instead of trying to limit based on a LIKE clause, I still get the command out of sync error.
10760
My overall upgrade went well, but I am left with a critically lingering issue of mysql-server not being able to install itself, and nothing I am trying gets it to work.  This is the error I see when trying to install/reinstall it:  Setting up mysql-server-5.7 (5.7.11-0ubuntu6) ... Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. invoke-rc.d: initscript mysql, action "start" failed. dpkg: error processing package mysql-server-5.7 (--configure):  subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server:  mysql-server depends on mysql-server-5.7; however:   Package mysql-server-5.7 is not configured yet.  dpkg: error processing package mysql-server (--configure):  dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure.                    Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ureadahead (0.100.0-19) ... Errors were encountered while processing:  mysql-server-5.7  mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1)   I've tried completely removing it, though doing so attempts to install MariaDB because of dependencies (?). Any suggestions on what I can do to fix this would be most welcome.  EDIT: Looks like I'm not the only one:
105791
So I'm trying to connect to an external db in order to access/update information located on a different non-wordpress database (oracle).  I tried constructing a new wpdb object (as suggested by many other posts on stack exchange) like so:  function initialize_rgr_db() {    global $rgr_db;    $rgr_db = new wpdb('usr', 'pw', 'sid', 'host'); }    However, I kept getting the "error connecting to database" when vardumping the $rgr_db object  debug.log displayed the following:  PHP Warning:  mysqli_real_connect(): (HY000/2003): Can't connect to MySQL server on 'host' (111) in /home/dowxx543z3a1/public_html/wp-includes/wp-db.php on line 1612   Alternatively, I tried using oci_connect like so:  $conn = oci_connect('usr', 'pw', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=host)(Port=1521)))(CONNECT_DATA=(SID=sid)))'); if(!$conn) {         error_log('DB CONNECTION ERROR NOOO');         die(); } ...   But then I got call to undefined function.  Based on what I found, it seems like oci8 is not installed in wordpress. Online I found instructions on how to install oci8 on things like xampp or local environments, but nothing related to wordpress and frankly I'm afraid to mess something up.  So, here's my question. If someone could tell me what I'm doing wrong with wpdb, I'd love to find out. My guess is maybe that the oracle sid != the dbname that wpdb requires as the third argument.  Otherwise, could someone offer some guidance as to how to install oci8 (through cpanel)?  Thank you so much.
31743
I am converting some module from d5 to d7, and in old code there is an update query like this:  &lt;?php db_query("UPDATE {a_table} SET count = count + 1 WHERE field1 = %d", $some_value);   As we see, it is incrementing a field value (AFAIK it is a mysql feature). But, if I use new style of update it won't work.  &lt;?php db_update('a_table')     -&gt;fields(array('count' =&gt; 'count + 1',))     -&gt;condition('field1', $some_value)     -&gt;execute();   Are there any workaround within new style of db update without running an extra query to get existing field value to increment it?