Page 1 of 1
PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 11:11
by Corsari
Hello to all of you
have this issue that is making me crazy , quite difficult to understand problem
I have a micro PHP app that has index.php ad a couple of others files *.php that are included in the index.php developed with xampp
let's call the two to be included files include1.php and include2.php
Well, if I try to include include1.php and include2.php, they are NOT included and you get the PHP exception files not present in such path
But, listen listen, if I rename the two files include1.txt and include2.txt THEY ARE INCLUDED!!!
So thank you if you save me from this headache
Please note , the system is basically linux, but the linux of a Synology (updated) NAS with the webstation enabled and all the rest ... and since on the same NAS, I have installed PHPMyAdmin and it does work ...
the Synology webstation setup is running an Apache 2.4 with php 7.4
Thank you for ideas , hints and tips
Robert
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:02
by Nobbie
Please show us the full original error message, the full index.php (please dont change anything!) and a screenshot of a directory listing.
P.S.: How did you create include1.php? With Notepad, very often files are named include1.php.txt instead and Windows Explorer hides(!) the .txt extension. Therefore the files seem to be "include1.php", but are not and therefore are not found.
And do you mount the NAS to your linux file system? Maybe there is a problem with file rights as well.
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:06
by Corsari
Hello thank you
I'll do it
cannot right now
But the thing is well explained above
In the same directory, the same index.php file I just change the include from include1.php to include1.txt and I then rename include1.php file to include1.txt
I refresh the browser and all the include1.txt content is printed, so include mechanism and DOCUMENT_ROOT variable are correctly working
while if browse with include1.php on the browser it shows the path and tells that index1.php is not present
all the three files do sits in the same directory
brb
I developed some years now, currently I do use Visual Studio Code, the app on xampp windows works like a charm
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:09
by Nobbie
We still dont know how your NAS is mounted to your PC? Where is Xampp installed? What is the DocumentRoot etc.? Running Apache from a NAS is always somewhat "tricky", as you have to give appropriate rights to appropriate users. There may also be a problem with uppercase/lowercase letters.
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:12
by Corsari
I'm just asking an hint
the NAS is Synology and you don't install .rpm or .deb files
you just "enable" packages
Just asking if such kind of behavior may be a setting of Apache or of PHP or if it is better to investigate something else
e.g. something to insert in .htaccess or (this is possible to be done) something to be edited in php.ini or in apache conf
thank you
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:13
by Nobbie
So this is not a Xampp installation. This forum is for Xampp Linux installations, we cannot support Synology NAS. Ask Synology if there is any restriction.
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:16
by Corsari
Sure, just asking
if somebody knows
if some setting may do this kind of behavior either in apache or php
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:17
by Corsari
e.g. have you ev er heard about ONLY php files to NOT being included while others files type are correctly included?
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 12:22
by Nobbie
Similar, the Provider 1&1 for example does NOT allow *.inc files for include.
What happens, if you try to open the include1.php directly (instead of including it), for example via
http://localhost/include1.php (or whatever URL you need for your NAS). Does Apache find it? Actually, you should ask Synology about that. I have no idea how the default configuration of their NAS is working. I personally have a QNAP NAS and it works fine.
Re: PHP Require not including PHP files but e.g. as TXT does
Posted:
02. June 2021 13:12
by Corsari
Forgot
Tried that too
Inserted and echo statement
It works
That is why I have asked here