Solved

drupal user warning: You have an error in your SQL syntax

Posted on 2010-11-27
10
1,086 Views
Last Modified: 2012-05-10
HI, I've tried to install the German Drupal on a fresh Windows Server 2008 Web Edition and get the following error message:

    * 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 D:\websites2\drupal\includes\menu.inc on line 315.
    * 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 D:\websites2\drupal\includes\menu.inc on line 315.

This is obviously not working because there is no content for the IN(). I had a look at the source code and found that the variable $placeholders must be empty.

I have cookies enabled so I reckon it must have something to do with my PHP installation. I also tried setting "session.save_handler = user" but it made no difference.

When I set it to "session.save_handler = files" I can see a session file being created in the file system on the server so this works fine.

I am aware of http://drupal.org/node/247360 but nothing from that post seems to work for me. Any help is very much appreciated!

Regards,
Dirk.
0
Comment
Question by:dirkil2
  • 6
  • 4
10 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34222288
I read the thread on drupal.org and the only thing (besides a wipe-clean reinstall) that jumped out at me was the $cookie_domain value.  You might be running on localhost?  
0
 

Author Comment

by:dirkil2
ID: 34222574
Yes i am Running on localhost
0
 

Author Comment

by:dirkil2
ID: 34222601
What do you suggest as a solution concerning the $cookie_domain value?
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34222609
Some of the comments seemed to suggest that if you used an IP address instead of localhost you might get past the line 315 issue.  Of course, some of the other comments seem to indicate that after such a change, a complete re-install of the data base and the code was required.

My guess is that Drupal may be doing setcookie() incorrectly.  The code snippet is an excerpt from a teaching script that shows the correct way to set a cross-subdomain cookie.  If Drupal ignored the count it is easy to see how a cookie could get bollixed when the domain was 'localhost' with no dots.
// MAKE THE COOKIE AVAILABLE TO ALL SUBDOMAINS - DOMAIN NAME STARTS WITH DOT AND OMITS WWW (OR OTHER SUBDOMAINS).
   $x = explode('.', strtolower($_SERVER["HTTP_HOST"]));
   $y = count($x);
   if ($y == 1) // MAYBE 'localhost'?
   {
      $cookie_domain = $x[0];
   }
   else // SOMETHING LIKE 'www2.atf70.whitehouse.gov'?
   {
   // USE THE LAST TWO POSITIONS TO MAKE THE HOST DOMAIN
      $cookie_domain = '.' . $x[$y-2] . '.' . $x[$y-1];
   }

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34222640
This link is fairly recent and might be helpful, too.
http://drupal.org/node/350271
0
 

Author Comment

by:dirkil2
ID: 34222642
I tried a complete re-install with 127.0.0.1 instead of localhost but I got the same error message.

I also debugged into the code on line 315 and found that the array $placeholders is empty in either case (127.0.0.1 and localhost).

I am not sure where exactly $placeholders is supposed to get its values from. If I knew that I could debug further.
0
 

Author Comment

by:dirkil2
ID: 34222657
Unfortunately, the links you mentioned are not helpful to me because I am running on a 64bit environment with IIS instead of apache. I also want the latest PHP version because of security issues.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34223224
Do you have a text editor with a code scanner or "find in files" ability?  You might be able to look up $placeholders that way.
0
 

Accepted Solution

by:
dirkil2 earned 0 total points
ID: 34251327
I couldn't find a solution; I only found out what probably caused the message. It must have to do with the web server. I am using IIS and when I exchanged that with Apache it worked straight away.

I suspect that it has to do with the displaying the progress bar during the installation and some security constraints. But I wasn't able to figure out exactly what it was.
0
 

Author Closing Comment

by:dirkil2
ID: 34281128
Found a workaround (see my last post.)
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
scan php uploads for viruses 5 23
Make login page safer 3 30
MySqli Real Escape String and SQL Injection 1 44
How to use session variables in php? 22 42
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question