You are here: Re: where can ini_set('include_path','.:..'); see? « All PHP « IT news, forums, messages
Re: where can ini_set('include_path','.:..'); see?

Posted by Steve on 04/02/07 18:48

"Paul" <lof@invalid.com> wrote in message
news:CSbQh.33414$68.16068@bignews8.bellsouth.net...
|>| Steve - this seems to be working on files EXCEPT those deeper in
| > | directories, for example, files within:
| > | /site/html/Quickform/
| > |
| > | throw the error:
| > | "Warning: main(HTML/Common.php) [function.main]: failed to open
stream:
| > No
| > | such file or directory in C:\site\HTML\QuickForm\element.php on line
22"
| > |
| > | Line 22 is:
| > | require_once('HTML/Common.php');
| > |
| > | There are also directoryies under /site/html/Quickform/, like
| > | /site/html/Quickform/Renderer/
| > | /site/html/Quickform/Rules/
| > |
| > | So I need it work for those as well.
| > |
| > | Any ideas? I think I/you/we am very close!
| >
| > yes. as someone else pointed out, most systems on which you place this
web
| > application are case-sensitive. as a rule for myself, i always
lower-case
| > all directory and file names. as you have probably guessed by now, i do
| > things very methodically...so much so that i type using lower case. ;^)
i
| > only use proper casing when i do formal writing.
| >
| > anyway, your problem now stems on the fact that you are requiring
| > HTML/Common.php, yet on your file system, you only have html/common.php.
| > make sense? in addition, your line 22 should be:
| >
| > require_once $relativePath . 'html/common.php'
| >
| > in order to make use of relative.path.php. also, i am assuming that your
| > web
| > root is /site.
| >
| > have you also thought about using something similar to site.cfg.php in
| > order
| > to define your directory structure literally, such that your scripts
refer
| > to paths via variables?
|
| I can actually put the following in /site/pages/page1.php and it works
fine:
| require_once $relativePath.'HTML/Common.php';
|
| But when put in:
| /site/html/Quickform/Element.php
|
| it throws:
| "Notice: Undefined variable: relativePath in
| C:\...\site\HTML\QuickForm\element.php on line 22"
|
| Despite the auto_prepend_file working in that file - I have checked.
|
| I think I need help making your code snippet go deeper in the directory
| settings. Instead of going up one level, it needs to go up another level
| but that will vary depending on where the file. Does that make sense?

it already DOES all that. it looks for '/' and replaces it with ''. the
difference between the original string and the replaced result (the path
minus the '/'s) is the number of directories to the current directory.
$relativePath simply creates a string by repeating '../' with the number of
replacements made. so:

/site/pages/somedir

would result in:

sitepagessomedir

that's three dir's shorter.

str_repeat would produce:

'../../../'

and if you were in 'somedir' and wanted to get to the root dir from the
command-line, that's exactly what you'd type. cd ../../../

same with php.


| Here's what's happening. When you open:
| /site/pages/page1.php
|
| it calls:
| /site/HTML/Quickform.php properly
|
| That file calls:
| /site/HTML/Quickform/elements.php, and THAT is where the error iccurs.
The
| %relativepath is not defined in /site/HTML/Quickform/elements.php despite
| the relative.path.php being included in that file. I can only conclude
that
| the dept to which the directory structure is being walked up or down is
not
| enough.
|
| Any ideas? Your help is MUCH appreciated!

debug. why not go to a directory that is deeply nested, create a new php
script like this:

<?
echo '<pre>' . $relativePath . '</pre>';
?>

does it produce the correct path for that directory to your root?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация