[gelöst] include() funktioniert nicht

Alles, was PHP betrifft, kann hier besprochen werden.

[gelöst] include() funktioniert nicht

Postby nicmoe » 05. July 2006 18:24

hi! ich habe ein dickes problem: wenn ich die include() funktion benutze meckert mein indianer sofort dass diese datei nicht gefunden wurde. das problem ist, dass die datei existiert! was kann man da machen?

system:
SuSE 10.0
Intel Celeron D
512 MB Ram
apache2 mit mod_php4
Last edited by nicmoe on 06. July 2006 19:44, edited 1 time in total.
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 05. July 2006 18:32

Wer meckert:
Der Apache oder PHP?

(ansonsten hilft hier nur die orginale Fehlermeldung)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby nicmoe » 05. July 2006 18:53

da wird halt die standartfehlermeldung im browser ausgegeben. ich kann sie ja mal posten:
Code: Select all
Warning: main(): Failed opening 'system/replace2.php' for inclusion (include_path='/usr/share/php') in /srv/www/htdocs/bxcp/show/news.php on line 3
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 05. July 2006 19:03

a) in welchem Verzeichnis ist die Datei "replace2.php"?
b) welche URI rufs du im Browser auf?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby nicmoe » 05. July 2006 19:06

ich rufe replace2.php in einem unterordner von dem ordner in dem die index liegt auf.
firefox 1.06
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 05. July 2006 19:29

Könntest du beide Fragen korrekt zu beantworten?

(Ich geh doch mal davon aus, das du Hilfe willst?)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby nicmoe » 05. July 2006 20:44

sorry hab des falsch gelesen...
also nochmal:
die replace ist unter /srv/www/htdocs/bxcp/system/
die url ist einfach localhost/bxcp (die datei wird vom index included)
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 05. July 2006 21:13

Hm, Also von der Theorie her sollte das tun:

die url ist einfach localhost/bxcp

Aufgerufen wird "/srv/www/htdocs/bxcp/index.php". Das Arbeitsverzeichnis ist also "/srv/www/htdocs/bxcp".

(die datei wird vom index included)
Failed opening 'system/replace2.php' for inclusion in /srv/www/htdocs/bxcp/show/news.php

Diese Datei (index.php) includiert die Datei "/srv/www/htdocs/bxcp/show/news.php" Welche wiederum den Include auf "system/replace2.php" enthält.

die replace ist unter /srv/www/htdocs/bxcp/system/

Auf Grund des Arbeitsverzeichnisses, das normal durch die über die URI aufgerufene Datei definiert wird, sollte also die Datei ""/srv/www/htdocs/bxcp/system/replace2.php" gefunden werden ("system/replace2.php" relativ zum Arbeitsverzeichnis)

BTW: du meintest hier doch eigentlich: "die replace2 ..."?

Irgendwo scheint also das Arbeitsverzeichnis verstellt zu werden. In der "news.php" kannst du ja mal folgendes vor Zeile 3 zum Testen einfügen:
Code: Select all
echo getcwd;
exit;
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby nicmoe » 05. July 2006 21:23

da kommt dann weisser bildschirm wo dick und fett getcwd geschrieben steht und nichts anderes. lasse ich exit weg kommt wieder das dokument, allerdings steht da auch nur getcwd
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 05. July 2006 21:35

Also laut Fehlermeldung steht in Zeile 3:
include 'system/replace2.php';
o.ä.
Und genau davor hast du das eingefügt?

(BTW: Wenn du schon so ein Script zustande bringst, solltest du es ja eigentlich auch debuggen können ;-)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby nicmoe » 06. July 2006 12:11

sicher hab ich das. hat aber nicht geklappt. anscheinend kann der des nicht verarbeiten.
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 06. July 2006 12:48

Ich sollte echt meine Posts nach dem Posten nochmal lesen...

Mal eine Frage: Das fehlende "()" nach getcwd also "echo getcwd();" hast du nicht zufällig von selbst ergänzt?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby nicmoe » 06. July 2006 18:31

nein. ich hab nicht dran gedacht... :(
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby nicmoe » 06. July 2006 18:34

Code: Select all
/srv/www/htdocs/bxcp
ist die antwort.
nicmoe
 
Posts: 12
Joined: 05. July 2006 18:12

Postby Wiedmann » 06. July 2006 19:18

(include_path='/usr/share/php')

Hier fehlt ein ".;" am Anfang:
--> include_path = ".;/usr/share/php"

(morgen gleich mal zu Fielmann gehen...)
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Next

Return to PHP

Who is online

Users browsing this forum: No registered users and 49 guests