You are here: Re: to stupid to see the mistake - include_path don't work « PHP Programming Language « IT news, forums, messages
Re: to stupid to see the mistake - include_path don't work

Posted by Kim Andrι Akerψ on 10/21/05 11:26

mirko@abitur97.de wrote:

> Hello,
>
> I have a problem with my include_path and I don't know why... Can
> anybody see the mistake?
>
> my configuration:
>
> PHP Version 4.3.11
>
> System: Windows NT 5.0 build 2195
> Server API: CGI/FastCGI
> Virtual Directory Support: enabled
> Configuration File (php.ini) Path: C:\WINNT\php.ini
> PHP API: 20020918
> PHP Extension: 20020429
> Thread Safety: enabled
> include_path: .;C:\Inetpub\wwwroot
>
> My php script used this:
>
> require("/development/classes/configWeb.php");
>
> and the configWeb File location is:
> C:\Inetpub\wwwroot\development\classes\configWeb.php
>
> And I geet this error message:
> Fatal error: getofficeslist(): Failed opening required
> '\development\classes\configWeb.php'
> (include_path='.;C:\Inetpub\wwwroot') in
> C:\Inetpub\wwwroot\development\classes\offices.php on line 45

What your script is actually trying to access, is
"c:\development\classes\configWeb.php", which is referenced in the
require() statement above. If you remove the slash from the beginning
of that file reference, you'll see that it works.

The way include_path works, it goes through each of the directories
(seperated by a semicolon) when you use include/require with a relative
path until it finds the file. This is only a side feature, since
include_path is meant to secure which directories a script is allowed
to include files from.

It will in your case look for the included file here (if making the
change I suggested):
..\development\classes\configWeb.php (from current working directory)
c:\Inetpub\wwwroot\development\classes\configWeb.php

--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация