* user warning: ERROR: syntax error at or near ")" at character 42 query:
SELECT * FROM menu_router WHERE path IN () ORDER BY fit DESC LIMIT 1 OFFSET 0 in /.../menu.inc on line 315.SOLUTION: EMPTY THE DATABASE
There are a large number of people wasting time on this bug.
Below is the solution I and others have found.
Regarding the "menu.inc on line 315" error while installing Drupal 6.3
Drupal seems to create database tables which are somehow incompatible with itself.
I was able to complete the installation by deleting (aka "dropping") all of the tables (ie "emptying the database").
This is done through PHPMyAdmin.
I then hit refresh in the Drupal installation browser window and my installation completed successfully!
(This is a Dreamhost install for those who are interested.)
Please spread the word!
- Jonathan Cross
A few other affected by this bug:
http://drupal.org/node/269968
http://drupal.org/node/247360
http://drupal.org/node/255015
http://drupal.org/node/260908
http://drupal.org/node/243458
http://drupal.org/node/280015
http://drupal.org/node/234539
Comments
menu.inc line 315 problem - repeats, won't change
This looks like the same problem - trying to install 6.3 on a clean db:
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY fit DESC LIMIT 0, 1' at line 1 query: SELECT * FROM menu_router WHERE path IN () ORDER BY fit DESC LIMIT 0, 1 in /.../menu.inc on line 315.I've dropped all tables and refreshed the install page several times over, with no change.
I've used Drupal for years, but 6.3 is new to me. Just a guess - it looks as if a variable in the script either contains the incorrect value, or the script doesn't take into account the possibility that the variable is undefined, with the result that the script creates a SELECT statement with improper syntax.
Does anyone have any suggestions on how to get the database configured in light of this error? It is a total show-stopper.
Finally installed!
Tried some of the other suggestions - add prefix, drop tables and refresh the browser, clear cookies and refresh, edit the $cookie_domain variable. None worked. However, I think the cookies are the place to focus. I opened a new browser (I had been using Firefox and switched to Konqueror, but I'm sure anything would do - or you could clear all personal information - cookies, cache and anything else), then open the install.php page and it worked.
not a bug in drupal, but php session settings misconfiguration
I had this case and tried everything (fastcgi patches, menu.inc patches, clearing cookies, dropping all tables, tuning drupal settings etc) proposed on this site, but nothing did work. Finally, I checked php session settings with phpinfo() and they strangely differed from defaults. Because the drupal installation was in httpdocs root, I simply added one line to Drupal .htaccess file, that changed a local value of session.cookie_path (the path for which the cookie is valid) back to the defaults:
Also, on a few existing Drupal sites this solved spooky "access denied" errors that usually occured immediately after login (the session was lost). When not installed into httpdocs root, but subdirectory, should be tested if session.cookie_path needs to correspond it.
PHP Configuration
I also had this problem when trying to install 6.4. I tried all of the above methods but none worked.
Finally I tried reconfiguring all PHP Session settings back to the default (I was working on a test server...) and drupal was finally installing without any problems.
This works - A sensible and concrete solution
Thanks, this solution worked for me. On local server (test server) you can alternatively do the following setting in "php.ini" file -
session.cookie_path = /This has the same affect as modifying the .htaccess file of your drupal projectFIX: Cookies issue for me
I received the error due to having cookies disabled in my browser.
The fix: (assuming a fresh installation and not an upgrade)
- Enable cookies in browser
- Drop tables in database (I used MySQL Admin to drop the schema and create a new one)
- Reset settings.php back to default. Copy default.settings.php (/drupal6-6/sites/default/), delete settings.php, and rename your copied version "default.settings.php" to "settings.php"
- If you're a linux user, enable read & write permissions on settings.php (chmod a+w settings.php)
- Start Drupal configuration again in your browser
Installed...
Here's what I did:
1. Deleted all Drupal files
2. Dropped all tables in the database (but not the database itself)
3. Extracted original Drupal files
4. Renamed settings.ini without changing ANY contents
5. Opened up index.php
6. Cleared all browser cache and cookies
7. Began install, re-entering all the database info as requested
-- At this point it gave me the same line 315 error --
8. With another window I used PHPMyAdmin to drop all the tables again
9. Refreshed the Drupal installation window
10. Finished.
I should point out, however, that this isn't a solution, merely an elaborate work-around. The problem isn't with the database tables with as far as I can see. The problem is with line 315 of menu.inc:
if ($router_item = db_fetch_array(db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1))) {
It has been shown that the error is caused because $placeholders is empty when the script reaches this line, creating an invalid SQL query. The fact that dropping the tables and refreshing works only tells us that $placeholders isn't empty the second time around, for whatever reason.
My personal solution
My solution included these reloads but only fixed itself after I enabled cookies for my personal domain in firefox.