LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-20-2016, 05:36 AM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Rep: Reputation: Disabled
PHP Notice: Undefined index / Undefined variable in /var/log/httpd/error_log


I've installed a pinterest clone script on a brand new hosting, and I've been getting a lot of errors like this (PHP Notices) in the error log:

PHP Notice: Undefined index: language in /home/www/html/domain.com/include/config.php on line 57
PHP Notice: Undefined variable: sban in /home/www/html/domain.com/include/config.php on line 158

As far as I was reading this may be something related to Register Globals setting, but I am not sure. This is suppose to be off by default as of now (or maybe on, I am not sure).

Basically I am wondering how could I fix this part so it does not show up there like tens of thousands times per day.

Script requirements here:

http://www.pinmescript.com/requirements
 
Old 06-20-2016, 05:41 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,484

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Generally a lot of "PHP Notice" messages would indicate poor coding in a script. Not defining variables before use, etc.

You could change the error reporting level in PHP to exclude E_NOTICE and these won't get logged.

Or correct the script.
 
Old 06-20-2016, 05:53 AM   #3
john2
Member
 
Registered: Aug 2004
Location: Wales
Distribution: Manjaro, Kubuntu, MX
Posts: 102

Rep: Reputation: 29
This is probably caused because a name needs to be enclosed in quotes
eg
Code:
$name = $row[myname];
should be
Code:
$name = $row['myname'];
Otherwise try defining the offending variable at the start of the script, for example
Code:
$myvar = "";

Last edited by john2; 06-20-2016 at 06:57 AM. Reason: typo - $ sign missing
 
Old 06-20-2016, 06:06 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Are you having trouble reading the requirements, or implementing them?
Start with https://mediatemple.net/community/pr...pinfo.php-page

So you can find out what the system thinks about the "requirements".

Google: "how to make a phpinfo page"

No sympathy.

Last edited by Habitual; 06-20-2016 at 06:07 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cron job error "PHP Notice: Undefined variable:.........." branddonchau CentOS 3 05-27-2015 04:08 AM
PHP Notice: Undefined offset: 1 in /var/opt/b.php on line 5 LnxGuru Linux - Newbie 3 05-23-2013 10:26 AM
PHP Problem ('undefined index', 'undefined function') zokken Programming 2 12-04-2008 10:18 AM
PHP Undefined index Error Gerardoj Programming 1 05-30-2004 03:30 AM
/var/log/httpd/error_log:Premature end of script headers! katana Linux - General 0 08-14-2001 06:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration