• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1641
  • Last Modified:

issues with log analyser php permissions

I am installing a syslog analyzer on a CentOS 5.5 box. I have installed apache and php and I can run a php.info page fine and see that php is working.

the syslog analyzer is loganalyzer from adiscon. It has a group of php files that just need to be installed on the apache server for it to work (in my case, the same server is the mysql server, syslog server, and apache server).

I have put the files into the correct locations as specified. However when i go to the homepage nothing loads. When looking through the error_logs for the web server I see the following:


[Thu Apr 28 12:29:33 2011] [client 10.1.1.96] PHP Fatal error:  Call to undefined function InitPhpLogCon() in /var/www/html/index.php on line 46
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include(./include/functions_common.php) [<a href='function.include'>function.include</a>]: failed to open stream: Permission denied in /var/www/html/index.php on line 39
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening './include/functions_common.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/index.php on line 39
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include(./include/functions_frontendhelpers.php) [<a href='function.include'>function.include</a>]: failed to open stream: Permission denied in /var/www/html/index.php on line 40
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening './include/functions_frontendhelpers.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/index.php on line 40
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include(./include/functions_filters.php) [<a href='function.include'>function.include</a>]: failed to open stream: Permission denied in /var/www/html/index.php on line 41
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening './include/functions_filters.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/index.php on line 41
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include(./classes/logstream.class.php) [<a href='function.include'>function.include</a>]: failed to open stream: Permission denied in /var/www/html/index.php on line 44
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening './classes/logstream.class.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/index.php on line 44
[Thu Apr 28 12:32:58 2011] [client 10.1.1.96] PHP Fatal error:  Call to undefined function InitPhpLogCon() in /var/www/html/index.php on line 46


Now I have tried changing the permissions of these files to 777 and the index.php page as well. Nothing seems to work. I get the same errors each time.

Also I dont know if this is intended, but if I try to browse to one of the include files I get permissions denied.

I imagine that this is a permissions issue but could also be related to the config of apache?
0
ryan80
Asked:
ryan80
  • 7
  • 5
1 Solution
 
arnoldCommented:
Do you have selinux running?  YOu have to make sure that these files have to correct context.  The other issue is that it might try to access the /var/log/ files which it does not have rights to.

The access restrictions are likely the cause of the errors referencing initphplogcon* /var/www/html/index.php line 46.

You might want to run the log processing from cron, while accessing the data through the web page.
0
 
ryan80Author Commented:
I am not using selinux.  The way that it is setup is that I am running rsyslog to collect logs from other devices. It is running and collecting the logs. it writes these logs to a mysql database which is working.

phplogcon is being used as the frontend for reviewing the logs. However it has not been configured at all. It should startup and launch into a graphical confiugration of the program, where I can enter the database information.

The issue I am having though seems to be just with getting this php page to work. I dont know why it cant access these dependencies.
0
 
arnoldCommented:
do you have an include in /var/www/html?
i.e. index.php refers to a relative location ./include/functions_common.php
Presumably you have /var/www/html/loganalyzer or something like that which should work.  Moving the file out of that directory and into a new one will lead to the break.

One option is to have your /var/www/html/index.html

have a <meta http-equiv="refresh" content="0; url=loganalyzer.index.php">
http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm
The above reference will direct the browser to access the other file.
0
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
ryan80Author Commented:
the location of the index.php is:

/var/www/html

The include files are located in:

/var/www/html/include




I was reading something online about possibley changing the ownership and group to apache for the folders under the www directory? could that be it?
0
 
arnoldCommented:
The permissions should be 755 on the directories and 644 on the files. They should not be owned by the apache user as that is a security risk.  In the event apache is exploited through an insecure script, the apache user can then be used to modify the files and distribute spam/virus  type things.

try on the command line php index.php what is the output ?
0
 
ryan80Author Commented:
ok, sounds good, then the permissions are correct.

when i run php index.php I get the following which is the correct message.


Critical Error occured  -       Errordetails:
        Error, main configuration file is missing!<br><br><center><b>Click <a href="./install.php">here</a> to Install Adiscon LogAnalyzer!</b><br><br></center>

0
 
arnoldCommented:
double check the permissions on the entire entry.  You may have to edit and configure the configuration file in the directory specifically that that provides info on the credentials that should be used to access the database.
0
 
ryan80Author Commented:
I ran the following commands on the /var/www directory

find -type d -print0 |xargs -0 chmod 755
find -type f -print0 |xargs -0 chmod 644

still having the same issue. Is there somewhere else that I should be checking?
0
 
ryan80Author Commented:
It must be a permissions issue on a file somewhere else besides the /var/www/html folder. I did a chmod -R 777 in that directory and that did not make a difference.
0
 
arnoldCommented:
IT is likely a missing configuration entry in a file that deals with the connection to the database server
cd include
grep -l '(3306|root|localhost)' *
see what files are returned. Then check each file to see whether it has the configuration for access into the database server
Usually these types of items include a README/INSTALL file that deals with setting up a user on the database server, etc.
0
 
ryan80Author Commented:
I dont think this is related to connecting to the database.

I havn't even gotten phplogcon running so I havnt defined what database to connect to yet. It is supposed to launch a web interface that will allow me to configure these options, but I cant get to there.

when I run that command, nothing is returned.
0
 
ryan80Author Commented:
OK, i dont know what happened, but somehow I messed up when copying the files. I deleted the directory, and copied the files over again from the source. Now it works.

Thanks for the help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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