We help IT Professionals succeed at work.

Server PHP Errors

Robert Granlund
Robert Granlund asked
on
Why would some people in certain parts of the country be getting a PHP error on a website and other people in different parts of the country not be getting the error?
Comment
Watch Question

Kent WSr. Network / Systems Admin

Commented:
The error they are receiving would be a good thing to post.

Does the site use any geo based DNS?

Author

Commented:
Let me know if you get the error: 23.101.151.179 fill out form and submit.  That is where folk get the error.
Kent WSr. Network / Systems Admin

Commented:
I did get this error.  It really looks like you need to track down the cause of the "Undefined variable: DB".   Wether it's the direct or indirect cause, that's probably the key.  Not being able to see the actual code, I can only say what I would do.  Have you checked the line number and code around it to see if there was something amiss?
Looks like you have PHP running on a Windows system.  May be a permissions issue?  You can turn on debugging in PHP also, and look at your web logs, these are going to hold the biggest clues.
I'm also hitting through a proxy, so tried hitting it direct.  Got the same error.

{!-- ra:00000000378f30ae000000004b0ff026 --}
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: DB

Filename: libraries/Functions.php(688) : eval()'d code

Line Number: 69
Fatal error: Call to a member function query() on a non-object in C:\inetpub\StarrSpokeDev\system\expressionengine\libraries\Functions.php(688) : eval()'d code on line 69 

Open in new window

Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
OK. This is what I can see and it seems odd, but it might help you to track down what's going on.

Yesterday when I tested this for you, I didn't get the errors. Just tested it again and didn't get any errors initially. Here's the weird part - If I enter an email address of test@test.com, it works fine. Any other email address and it bombs out.

This tells me that somewhere in your code it's doing a database lookup regarding the email address. I'm guessing that test@test.com is probably in your database (it's a common address people use when testing), and so no error is generated. Addresses not in your database are causing problems.

Have a look at your database and try the form using an address that already exists, and then try it with addresses that don't exist.

I know that won't solve your problem, but it may help you focus your attention in the right place.

Of course, I could be way of the mark, and something else is going on :)

Author

Commented:
That was it.   There was a spelling mistake in on of the if clauses.  Man, I feel dumb right now.