PHP enthält den relativen Pfad

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: PHP enthält den relativen Pfad

by Guest » 08 Jan 2025, 09:07

Ich habe die Datei /root/update/test.php. Es gibt auch eine Datei, /root/connect.php; Diese Datei hat eine Zeile

Code: Select all

include "../config.php";
In /root/update/test.php. Da ist der Code

Code: Select all

set_include_path(".:/root");
include "connect.php";
Wenn ich /root/update/test.php ausführe, wird connect.php gefunden, config.php jedoch nicht, was mir Folgendes anzeigt:

Code: Select all

PHP Warning:  include(../config.php): failed to open stream: No such file or directory in /root/connect.php on line 2
PHP Warning:  include(): Failed opening '../config.php' for inclusion (include_path='.:/root')
Das ist für mich verwirrend, weil die Warnungen den Eindruck erwecken, als würde ich alles richtig machen – der Include-Pfad ist /root und es wird nach der Datei ../config gesucht .php (/config.php), die vorhanden ist. Kann mir das jemand klären? Beachten Sie, dass die Verwendung absoluter Pfade für mich keine Option ist, da die Bereitstellung auf einem Produktionsserver erfolgt, auf den ich keinen Zugriff habe.

Ubuntu/Apache

Top