Why php runs the code only on the main page?

Why php code runs only on the main page, and other files from other folders, it returns the PHP code text?
The extension on all php files, the server running this PHP script works on the home.
include 'set/menu.php'
March 23rd 20 at 19:20
2 answers
March 23rd 20 at 19:22
Well, sometimes you need to be a detective )
1) copy the file which is in folder, check if it opens from there(accordingly the case may be in the file encoding or something else)
2) Rename .htaccess in .htaccess_ (check that's not the problem .htaccess), and in folders if there are.
3) Put in a file folder index.php and try to specify the path to the folder in the url, it is possible that somewhere in the settings is noindex(afaik it happens)
4) There is a suspicion that you open files "from other folders" not through the url and using a path like c:\server\localhost\myfolder\some.php then of course be interpreted your files won't be stupidly open as the hypertext markup language.
March 23rd 20 at 19:24
If there are any file .htaccess on your server? Maybe it prohibited the execution of scripts in subdirectories?
RewriteEngine on

RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteRule ^(.*)$ ./api.php?path=$1 [L,QSA] 

#RewriteCond %{REQUEST_URI} ^\/api\/(.*)$
#RewriteRule ^api\/(.*)$ /api.php?path=$1 [QSA,R=301,L]
- Amina39 commented on March 23rd 20 at 19:27
@Amina39, and in nested directories not? - Newton.Waters commented on March 23rd 20 at 19:30

Find more questions by tags PHP