OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

PHP Notice: Undefined variable:

eliufoo

27-08-2009 04:31:54

Hi everyone,

I'm very new to the OpenNetAdmin tool and I'm trying it for the first time. I have finished the installation successfully with no errors and managed to access the front web interface. However, I can not log out or login in as root.

i can get to the login page by typing http://localhost/ona/login.php, insert admin | admin. After login, i come back on the guest account.

view the error_log file for apache, I'm seeing the following entries when I try to logout.

[Thu Aug 27 03:55:45 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: https in /opt/ona/www/logout.php on line 19, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:45 2009] [error] [client 192.168.0.1] PHP Notice: Undefined index: user in /opt/ona/www/index.php on line 24, referer: http://192.168.0.128/ona/logout.php
[Thu Aug 27 03:55:45 2009] [error] [client 192.168.0.1] PHP Notice: Undefined index: skip_version_check in /opt/ona/www/include/html_desktop.inc.php on line 26, referer: http://192.168.0.128/ona/logout.php
[Thu Aug 27 03:55:46 2009] [error] [client 192.168.0.1] PHP Notice: Undefined index: content_box in /opt/ona/www/include/html_desktop.inc.php on line 194, referer: http://192.168.0.128/ona/logout.php
[Thu Aug 27 03:55:46 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: MOTD in /opt/ona/www/include/html_desktop.inc.php on line 366, referer: http://192.168.0.128/ona/logout.php
[Thu Aug 27 03:55:46 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: work_space in /opt/ona/www/include/html_desktop.inc.php on line 493, referer: http://192.168.0.128/ona/logout.php
[Thu Aug 27 03:55:46 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: search in /opt/ona/www/include/html_desktop.inc.php on line 505, referer: http://192.168.0.128/ona/logout.php
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined index: work_space in /opt/ona/www/winc/work_space.inc.php on line 164, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined index: work_space in /opt/ona/www/winc/work_space.inc.php on line 178, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: history in /opt/ona/www/winc/work_space.inc.php on line 179, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: history in /opt/ona/www/winc/work_space.inc.php on line 179, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: year in /opt/ona/www/winc/work_space.inc.php on line 181, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: history in /opt/ona/www/winc/work_space.inc.php on line 182, referer: http://192.168.0.128/ona/
[Thu Aug 27 03:55:47 2009] [error] [client 192.168.0.1] PHP Notice: Undefined variable: history in /opt/ona/www/winc/work_space.inc.php on line 182, referer: http://192.168.0.128/ona/


please assist...

thanks,
elly

Matt

27-08-2009 09:00:28

By default, the system has an admin and a guest user. There is no root user (you may have that confused with the mysql administrator user?).

You should be able to log in as 'admin' with a password of 'admin' then you can create new users and change the admin password after that. (click the person icon next to the username box in the top right to change passwords)

As far as the PHP notice messages in your error_log, these are actually harmless and are not an indication of an issue. If you would like to stop them from logging (and using HD space) you can add the following to your /opt/ona/www/index.php file:

error_reporting (E_ALL ^ E_NOTICE);

I will be adding this to the next release as well..

Hope that helps.. let me know if it doesnt fix the issue.

eliufoo

28-08-2009 05:22:05

hi,

Thanks for the quick response. You have just encourage me to use this tool even more.

Ok, on the password side, I'm not confusing it with the mysql account. When I click logout, it returns me back to the same Main screen [logged in as guest]. Hence, i can't change my account to admin and continue with other features.

Could this relate to parameteres configured on the php.ini?

thanks,
Elly

Matt

28-08-2009 07:41:18

Yep sounds like you are doing it all right..

This very well could be an issue with php.ini settings. The really annoying part is this issue sounds very familiar to me but I cannot remember what causes it. php.ini seems to be the thing that my gut is saying is causing the issue.

One thing you might try is to bump up the debug value in the sys_config table using a sql statement to something like 5. Then you can look at /var/log/ona.log and see if there are anymore hints as to what is going on. I'll try and dig on it a bit more and see whats up.. Sorry I dont have a quick answer on this one.

eliufoo

28-08-2009 07:51:26

Not a problem...

Now, what are the steps in increasing the debug to 5?

I believe in we can nail this problem very soon :-) and find a permanent solution.

Additionally, we can share php.ini file and compare the parameters

thanks,
elly

eliufoo

28-08-2009 08:03:10

hi,

I made changes on the sys_log to 5 but, i'm not seeing any errors.

When i click logout, this is the message i'm receiving on /var/log/ona.log

Aug 28 5:35:19 localhost.localdomain [email protected]: INFO => Authorization successful for guest

Matt

28-08-2009 09:09:46

Ok, I'll start by sending you my php.ini file.. it is not actually a tar file I just added that extension to the name.. my system is an ubuntu box.

eliufoo

30-08-2009 10:10:31

Hi Matt,

Ok. I tried using your php.ini but still ended up with the same results. The application is just refusing to login as admin.

Can we also compare what php modules you have installed!?

Currenlty, these are the ones I have installed

[root@localhost ona]# rpm -qa | grep php
php-ldap-5.1.6-23.2.el5_3
php-common-5.1.6-23.2.el5_3
php-pear-db-1.7.13-2.el5.rf
php-pdo-5.1.6-23.2.el5_3
php-pear-1.4.9-4.el5.1
php-mysql-5.1.6-23.2.el5_3
php-gd-5.1.6-23.2.el5_3
php-cli-5.1.6-23.2.el5_3
php-snmp-5.1.6-23.2.el5_3
php-5.1.6-23.2.el5_3
[root@localhost ona]#

Matt

31-08-2009 09:34:49

One command that might be a bit better is 'php -m'. At the bottom of this post is my output from that. I am using ubuntu so my list of packages will be different than yours.

One thing I'd like to dig further on is the connection to mysql. It seems to me it is having trouble connecting to the database somehow. You will want to look at the file '/opt/ona/www/local/config/database_settings.inc.php' and check that the settings there are what you would expect them to be. Mine are like this:

'primary' => array(
'db_type' => 'mysqlt', // using mysqlt for transaction support
'db_host' => 'localhost',
'db_login' => 'ona_sys',
'db_passwd' => '',
'db_database' => 'ona',
'db_debug' => false,


You should then try and log into mysql from the cli with something like the following: mysql -p -u ona_sys ona


$ php -m
[PHP Modules]
bcmath
bz2
calendar
ctype
curl
date
dba
dom
exif
filter
ftp
gd
gettext
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mime_magic
mysql
mysqli
ncurses
openssl
pcntl
pcre
PDO
pdo_mysql
posix
readline
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
standard
svn
syck
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdiff
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

wiedernix

01-09-2009 02:28:16

Hello,

I'm experiencing the same error, login.php is not used - you're automatically logged in
as user guest (the same with http://hostname/ona/login.php with admin/admin).

I've tried both ona-v9.05.02 and v09.07.15 on RHEL 5.3 (64 Bit, Selinux permissive),
and adjusted my php.ini

bye
,
Stefan

eliufoo

01-09-2009 12:47:17

Hi Matt,

Ok. I checked my database_settings.inc.php file and the user settings. Also did the mysql connection and it worked. The user defined on the database_settings.inc.php can access ona database.

Still not sure where the problem could be.

The operating system I'm using is CentOS 5.x

Output for php -m

[root@localhost config]# php -m
[PHP Modules]
bz2
calendar
ctype
curl
date
dbase
exif
ftp
gd
gettext
gmp
hash
iconv
ldap
libxml
mime_magic
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
pspell
Reflection
session
shmop
SimpleXML
snmp
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
zlib

[Zend Modules]



Any other angels I should investigate?

Matt

01-09-2009 21:20:37

I've been wracking my brain trying to remember what this issue was.. and I know I've seen it before. Here is a snip from an ancient forum post that is no longer online. I'd suggest we re-visit the error reporting stuff in your php.ini.


Re: undefined index errors

The "Undefined" messages you are getting in the apache log are actually ok. They are a result of my sloppy coding on my part and the fact that I usually run my php configuration with the following statement in the php.ini file:


error_reporting = E_ALL & ~E_NOTICE


The messages you are seeing are just notices etc about how I should be declaring my variables first before using them. Since PHP is configured to display them it starts to effect the XML that is sent as part of the interface.

There are two things you could do. Add the "& ~E_NOTICE" to your error_reporting line or you can set "display_errors = Off"

As to what you choose to do is dependent on your environment and what you need but either or both of these settings should be fine for most people.



The reply to that post was:


Re: undefined index errors
Thanks Matt!

That was the key: reported php errors were garbaging all the xml received by navigator.

error_reporting = E_ALL & ~E_NOTICE

Now I can access all menu items and check how the program works.


I think it is the error messages that are being printed. This guy was using SuSE.

eliufoo

13-09-2009 05:29:31

Hi matt,

sorry for the late feedback, had a crazy week..

Now, I have tried adding the line on both ona/www/index.php and then tried on /etc/php.ini. But still ended up with the results.

Starting to believe it could relate distro version.

Matt

13-09-2009 17:49:41

Hmm well this is quite annoying. Thanks for sticking with me on it. That way others can benefit!

Ok.. so here is the next thing I'd like to try.

Download the DCM.PL utility. This is the command line interface for ONA. I want to see if it behaves as it should. Start on this page (http://opennetadmin.com/docs/utils/dcm.pl) then go download it using the link provided.

Once you have it installed try running the following:

dcm.pl -r subnet_add

Then try:

dcm.pl -r subnet_add name=TEST ip=10.1.1.0 netmask=255.255.255.0 type=LAN

You should get some feedback on how it is working just from the CLI. Also watch your apache error_log as well as /var/log/phperror.log or equiv. Also watch the /var/log/ona.log as well. Post the content of each of those logs here.

Thanks!

eliufoo

27-09-2009 05:59:31

Hi Matt,

Again.. Sorry for the delay and thanks for sticking with me on this issue.

Ok. I did what you requested but didn't get any logs entry on both /var/log/httpd/error.log & /var/log/ona.log.

However, from the CLI, I received these notification.

[root@localhost www]# pwd
/opt/ona/www
[root@localhost www]# ls -l dcm.pl
-rwxrwx--- 1 elly elly 17809 Sep 27 09:25 dcm.pl
[root@localhost www]#

[root@localhost elly]# ./dcm.pl -r subnet_add
./dcm.pl: line 1: !DOCTYPE: No such file or directory
./dcm.pl: line 2: syntax error near unexpected token `newline'
./dcm.pl: line 2: ` "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'

[root@localhost elly]# ./dcm.pl -r subnet_add name=TEST ip=10.1.1.0 netmask=255.255.255.0 type=LAN
./dcm.pl: line 1: !DOCTYPE: No such file or directory
./dcm.pl: line 2: syntax error near unexpected token `newline'
./dcm.pl: line 2: ` "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'


I hope this helps.

p.s: i will respond alot faster this time around.

Matt

27-09-2009 20:17:45

hmm well this is good.. its more to go off of.. I'm researching what it might be..

For now I have tried to recreate the issue by installing CentOS as well. However, it all worked for me with no issues. So I'll post the steps I took to get it working in hopes it might help out somehow?

*Started with CentOS 5.2 vmware image that I downloaded from www.thoughtpolice.co.uk/vmware/
*yum install httpd mysql-server mysql php php-mysql
*service httpd start
*service mysqld start
*tar -C /opt -zxvf ona-v09.09.15.tar.gz
*ln -s /opt/ona/www /var/www/html/ona
*Had to turn off selinux from enforce mode. you can do a "getenforce" and see what the state of selinux is. Then I used "setenforce permissive". You'll probably need to restart apache?
*chown -R apache /opt/ona/www

That was it. When I ran the installer I made sure all the prerequisites were "yes". It all ran ok for me at that point.

I suspect you did much the same so the problem is probably something else. I'll see what I can find out about the DOCTYPE error stuff you were getting.

Also I'm out of town tomorrow so it will be a bit before I can respond.