Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > include_path ?
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 11th March 09:41
tom_sawyer70
External User
 
Posts: 1
Default include_path ?



I am running SuSE 10, Apache2 and PHP5 and have a question about the
include_path directive in the php.ini. I am trying to use include
files for a navigation bar on a family-type website.

The www path is /srv/www/htdocs. This directory has a subdirectory
for each family member and one that is called "includes." I have
changed my include_path in the /etc/php5/apache2/php.ini file, and if
I check it with an info.php call, I can see that /srv/www/htdocs/
includes is in the include_path. Within the includes directory, I
have a navigation file called nav.php.

When I browse, my /srv/www/htdocs/index.php calls

<?php include ("includes/nav.php"); ?>

and this displays the file in the appropriate location (based on my
css). I noted, however, that if I do not include the "includes/"
path, this does not work...which is confusing to me, because I was
under the impression that if the /srv/www/htdocs/includes path is in
the include_path directive, that it would look for the file there if
it was not in the root directory of the site.

Further, when I try to link to it from a member subdirectory, I cannot
seem to link to the nav.php file.

I tried <?php include ("nav.php"); ?> again thinking that since the
path is in the php.ini, it would find the file. I've also tried
variations of include/nav.php, ./include/nav.php, ../include/nav.php,
etc. but cannot get it to work. Obviously, I am not understanding the
role of the include_path or some other component. I've checked the
permissions on the directories and files, which worked with hard-coded
html prior to my attempt to convert this to include files. I am not
getting an error (I have turned display_errors = on, the navigation
information is simply not displayed.

What am I missing, or is there a way to check the path within the code
to trace what the script is looking for and/or what it cannot access?

TIA.
  Reply With Quote


  sponsored links


2 11th March 09:41
j.o. aho
External User
 
Posts: 1
Default include_path ?



Check that you do not have two lines with include_path, if so, the later one
will be used.


--

//Aho
  Reply With Quote
3 11th March 09:41
tom_sawyer70
External User
 
Posts: 1
Default include_path ?


I only have one include path that is not remarked out (there are some
listed for UNIX):
include_path = ".;/srv/www/htdocs/includes;usr/share/php5;/usr/share/
php5/PEAR"

I also renamed the /etc/apache2/cli/php.ini just to make sure that it
wasn't being read.
  Reply With Quote
4 11th March 09:41
j.o. aho
External User
 
Posts: 1
Default include_path ?


The line you have has a syntax problem and thats why it don't work, the
separator is : and not ;

so your configuration should look like this (one line):
include_path = ".:/srv/www/htdocs/includes:usr/share/php5:/usr/share/php5/PEAR"


--

//Aho
  Reply With Quote
5 11th March 09:42
tom_sawyer70
External User
 
Posts: 1
Default include_path ?


Hmm...changed the syntax, restarted apache, tried again and it didn't
work. I tried the full URL, ../includes/nav.php, ./includes/nav.php,
and /srv/www/htdocs/includes/nav.php, all without luck.

Is there a way to turn on some type of verbose error logging?

One thing from my earlier post that did change is that I no longer
need the path "includes" in the index.php file anymore, so the syntax
did clear that problem.
  Reply With Quote
6 11th March 09:42
tom_sawyer70
External User
 
Posts: 1
Default include_path ?


I guess that another way to specify my question is this...

If I have a structure that is:
/srv/www/htdocs/index.php

and it can call nav.php, which is in /srv/www/htdocs/includes/ because
the include_path is in the php.ini, then what syntax should I use to
call that same nav.php file if the file calling the nav.php is located
in:

/srv/www/htdocs/family1/family1.html

?

Should it find nav.php due to the "search path" from the include_path
statement, should it be something along the lines of "./include/
nav.php", or something similar?
  Reply With Quote
7 11th March 09:42
j.o. aho
External User
 
Posts: 1
Default include_path ?


include('nav.php');

of course the

include('../include/nav.php')

and

include('/srv/www/htdocs/includes/nav'php');

will work and are ok too.


Of course the safe_mode* settings can affect things.
If you want more error notifications, then set

error_reporting = E_ALL

--

//Aho
  Reply With Quote
8 11th March 09:42
tom_sawyer70
External User
 
Posts: 1
Default include_path ?


It's almost as if the php within the html does not function. If I
replace the include with html, it works and shows up in the
appropriate place due to my css. If I issue a php command, nothing
shows...regardless of whether it's an include statement, an echo of a
string or and echo of a variable. I've placed all of my do***ents in
the root of the site and the index.php (with an include) works, but no
other files can reference the very same include file even if they're
all in the same directory with the same permissions.

I'm at a loss.
  Reply With Quote
9 11th March 13:17
tom_sawyer70
External User
 
Posts: 1
Default include_path ?


I cannot get anything php related to seem to process with this page.
Ideally, I'd like to include a file where the <div id="nav"> starts,
but I cannot even get a simply echo statement to process.

So in my test, I set a variable at the top and want to display it in
my navigation window. The CSS works, as the format appears
correctly. However, it does not appear that php is processing
anything past the first line.

The include path is defined as:
..:/srv/www/htdocs:/srv/www/htdocs/includes:usr/share/php5:/usr/share/
php5/PEAR

The root of the site is /srv/www/htdocs and has the web.css. The file
below is in a subdirectory "jennifer" and references the web.css from
the higher level.

Ultimately, I'd like to call web.css from the subdir jennifer, and
include a navigation file that can be found in /srv/www/htdocs/
includes/nav.php.

TIA.

=====

<?php $thisPage='jennifer';?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
<title>The Family Page</title>
<link rel="stylesheet" type="text/css" href="../web.css" />
</head>

<body>

<div id="header">
<h1>The Family</h1>
</div>

<div id="nav">
<?php echo $thisPage;
?>
</div>


<div id="content">
<h2>Welcome!</h2>
<img class="floatright" src="jennifer.jpg" width="90" height="120"
align="right" alt="Jennifer's Picture" />
<p>Jennifer's page</p>

<h2>Latest News and Information</h2>
<p>Improvements to this site.</p>
<?php echo $thisPage;
?>

<h2>What's Coming Soon!</h2>
<p>More improvements to this site.</p>

</div>

</body>

</html>
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666