LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   why is the problem (php, apache?) (https://www.linuxquestions.org/questions/programming-9/why-is-the-problem-php-apache-305945/)

ilnli 03-25-2005 11:29 AM

why is the problem (php, apache?)
 
here is some part of apache error_log file

Code:

[Fri Mar 25 01:24:13 2005] [error] PHP Fatal error:  main(): Failed opening required './l
ibraries/grab_globals.lib.php' (include_path='.:/usr/lib/php') in /var/www/html/php/index
.php on line 9
[Fri Mar 25 01:24:24 2005] [error] PHP Warning:  main(./libraries/grab_globals.lib.php):
failed to open stream: Permission denied in /var/www/html/php/index.php on line 9
[Fri Mar 25 01:24:24 2005] [error] PHP Fatal error:  main(): Failed opening required './l
ibraries/grab_globals.lib.php' (include_path='.:/usr/lib/php') in /var/www/html/php/index
.php on line 9
[Fri Mar 25 01:26:25 2005] [error] [client 127.0.0.1] File does not exist: /var/www/htdoc
s/html/php/index.php
[Fri Mar 25 01:26:34 2005] [error] [client 127.0.0.1] File does not exist: /var/www/htdoc
s/var/www/html/php/index.php
[Fri Mar 25 01:28:58 2005] [error] PHP Warning:  main(./libraries/common.lib.php): failed
 to open stream: Permission denied in /var/www/html/php/index.php on line 10
[Fri Mar 25 01:28:58 2005] [error] PHP Fatal error:  main(): Failed opening required './l
ibraries/common.lib.php' (include_path='.:/usr/lib/php') in /var/www/html/php/index.php o
n line 10
[Fri Mar 25 01:29:27 2005] [error] PHP Fatal error:  Call to undefined function:  pma_set
fontsizes() in /var/www/html/php/index.php on line 13
[Fri Mar 25 01:30:14 2005] [error] PHP Warning:  main(./libraries/grab_globals.lib.php):
failed to open stream: Permission denied in /var/www/html/php/index.php on line 9
[Fri Mar 25 01:30:14 2005] [error] PHP Fatal error:  main(): Failed opening required './l
ibraries/grab_globals.lib.php' (include_path='.:/usr/lib/php') in /var/www/html/php/index
.php on line 9

here is some part of my httpd.conf file
Code:

# By default, all external Apache modules are disabled.  To enable a particular
# module for Apache, make sure the necessary packages are installed.  Then
# uncomment the appropriate Include line below, save the file, and restart
# Apache.  Note that some modules may need additional configuration steps.  For
# example, mod_ssl requires a site certificate which you may need to generate.
#
# Lastly, if you remove a module package, be sure to edit this file and comment
# out the appropriate Include line.

# ==> mod_php configuration settings <==
#
# PACKAGES REQUIRED:  openssl-solibs (A series) and/or openssl (N series),
#                    mysql (AP series), gmp (L series), and apache (N series)
#
Include /etc/apache/mod_php.conf

# ==> mod_ssl configuration settings <==
#
# PACKAGES REQUIRED:  apache (N series) and openssl (N series)
#
#Include /etc/apache/mod_ssl.conf

here is some part of my index.php file which i am trying to run
Code:

<?php
/* $Id: index.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:


/**
 * Gets core libraries and defines some variables
 */
require_once('./libraries/grab_globals.lib.php');              /////////This is the line 9
require_once('./libraries/common.lib.php');                    /////////This is the line 10

// Gets the default font sizes
PMA_setFontSizes();

// Gets the host name
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
if (empty($HTTP_HOST)) {
    if (!empty($_ENV) && isset($_ENV['HTTP_HOST'])) {
        $HTTP_HOST = $_ENV['HTTP_HOST'];
    }
    else if (@getenv('HTTP_HOST')) {
        $HTTP_HOST = getenv('HTTP_HOST');
    }
    else {
        $HTTP_HOST = '';
    }
}


"/var/www/html/php/index.php" 115L, 5036C                              9,1          Top

when i open the index.php file it executes but does not show any error or output can anyone tell me what is the problem with my php or apache.

TheLinuxDuck 03-25-2005 02:12 PM

The apache error log is showing the errors that the script is having, which is the require once calls. Note this section of the log file:
Quote:

[Fri Mar 25 01:28:58 2005] [error] PHP Warning:
main(./libraries/common.lib.php): failed to open stream:
Permission denied in /var/www/html/php/index.php on line 10
[Fri Mar 25 01:28:58 2005] [error] PHP Fatal error:
main(): Failed opening required './libraries/common.lib.php'
(include_path='.:/usr/lib/php') in /var/www/html/php/index.php on line 10
Apparently, the http server does not have permission to access the files that you're trying to include.

I would:
* Verify that the files, in fact, exist.
* Note their owner/group/permissions
* Note owner/group of http instance, as set in the httpd.conf file
* Test a simple php script, something as simple as:
Code:

<?php phpinfo(); ?>
If that works fine w/o giving errors to the error_log file, then I would do a simple php script to test the read permissions on the library files you're including, and their paths. Maybe something like:
Code:

<?php
  $lib    = '/usr/lib/php/libraries/grab_globals.lib.php';
  $pieces = explode('/', $lib);
  array_shift($pieces);
  $path  = '';

  foreach($pieces as $piece) {
    if($piece == '') { next; }
    $path .= '/' . $piece;
    if(is_readable($path)) {
      echo "I have permission to read '$path'<BR>\n";
    }
    else {
      echo "Cannot read '$path!'<BR>\n";
      exit;
    }
  }
?>

That will tell you where, in the path, the permission denied is happening.

This would a start. (=


All times are GMT -5. The time now is 12:33 PM.