Include (../x.php) doesn't work on my Linux server why? -
In my XMP I can:
need_once ('../ myFile Php ');
And it works.
When I want to upload a file, it does not work.
There is an error on the server:
WARNING: need_once (.. / myFile.php) [function.require-once]: failed to open the stream: / home / Xxx / public_html / Yyyy / testinclude.php Fatal error on line 11: require_once () [function.require]: Required to open '../myfile.php' (include_path = '.: / Usr / lib / php: / / 11 / Any thoughts on /home/xxx/public_html/yyyy/testinclude.php line 11 in usr / local / lib / php ')?
One possible reason for this is that your file-wrapper is not exactly the same.
In UNIX, file paths are case-sensitive. This is not the case in win, therefore, if you are including ../ myFile.php
, then your file should be named myFile.php
, not Myfile.php
.
In addition, included
always contains files according to the current path . Consider these two files.
/home/xxx/public_html/first.php & lt ?? Includes php ('dir / second.php'); ? & Gt; /home/xxx/public_html/dir/second.php & lt ?? Php included ('third .php'); ? & Gt; When going on
first.php
, the second file will contain /home/xxx/public_html/third.php
.
> When going directly dir / second.php
, it will contain /home/xxx/public_html/dir/third.php
.
If you currently need to include relative to the current file, then use the following:
Include (Dynamics (__ file__). '/ Third.php ');
By using the above code section, dir / second.php
always /home/xxx/public_html/dir/third.php
Regardless of the current directory.
Comments
Post a Comment