[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 449
  • Last Modified:

xampp Notice: Undefined variable: gsLanguage

On my host the code works fine . .but on the xampp I get this error. Is there anything I need to enable on XAMPP?
0
Starquest321
Asked:
Starquest321
4 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
It sounds like you're missing the file that defines 'gsLanguage'.
0
 
MurfurFull Stack DeveloperCommented:
What platform are you running XAMPP on, what version of XAMPP are you running and what web application are you hosting i.e. the one that generates this error?
0
 
Ray PaseurCommented:
I'm going to guess a bit here and say this almost looks like a PHP Notice-level message.  See my example here:
http://iconoun.com/demo/temp_starquest321.php

<?php // demo/temp_starquest321.php
error_reporting(E_ALL);
$x = $gsLanguage;

Open in new window

By way of explanation, the default configuration of PHP causes Notice-level messages to be suppressed.**  This allows you to use undefined variables as if they were equal to the generic "falsy" values of zero, NULL, FALSE, etc.  If you visualize the Notice-level messages (see line 2 of the code snippet), PHP will tell you when your script relies on an undefined variable.

You can see your error_reporting() level by running phpinfo().  You can turn off Notice messages with the error_reporting() setting shown below, however I would fire a programmer who did this.  The right answer is not to suppress messages, but to find and correct the underlying Notice, Warning and Error conditions!
error_reporting(E_ALL ^ E_NOTICE);

Open in new window

PHP error_reporting is also settable in php.ini.

** Default settings in current PHP: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Starquest321Author Commented:
You are all correct:

Official answer from support:

If you enable error_reporting(E_ALL), PHP will report everything, including notices.
 
$gsLanguage is a variable declared in config*.php, if your page does not include it and you use it without declaring yourself, you get the notice.

Where do I set the error reporting? Is it in the php.ini?
0
 
Ray PaseurCommented:
Where do I set the error reporting? Is it in the php.ini?
Please read the answer that was posted yesterday in this link:
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28506214.html#a40288196
The right answer is not to suppress messages, but to find and correct the underlying Notice, Warning and Error conditions!
0
 
Dave BaldwinFixer of ProblemsCommented:
On shared hosting where you do not have access to php.ini, you have to put the error reporting line error_reporting(E_ALL); at the top of every page that you need to check.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now