include not behaving properly

I am doing modifications to an e-commerce site designed by a different programmer. I have created a ‘dev’ folder off of the root on the server and I have mirrored the entire site into this folder for testing purposes. Fortunately, relative pathing has made this a somewhat easy process… until now.

In the root ‘dev’ folder is a file ‘z_index.php’. In it is the PHP statement ‘include(‘inc/functions.php’);’. It is my understanding that this statement should then include the file ‘/dev/inc/functions.php’, but instead it includes the file ‘/inc/functions.php’. When I change the statement to ‘include(’/dev/inc/functions.php’);’ to path it from the root to the file in the ‘/dev/inc’ folder, nothing gets included at all.

I do not understand why I am unable to get the ‘functions.php’ to be included from the ‘/dev/inc’ folder.

This is making me feel really dumb… and I’m not! Any help would be appreciated.

include(’/dev/inc/functions.php’); must works, if don’t check privileges.

but you can use relative path, if php file at “/”, you can do include(‘dev/inc/functions.php’);
if php file at “/dev”, you can do include(‘inc/functions.php’);
if php file at “/XXX”, you can do include(’…/dev/inc/functions.php’);
Check always privileges, not only the file, check you can read and execute all folders included in path.

Aha! That has worked. I thought I tried every variation of the path, but doing include(’…/dev/inc/functions.php’); has worked.

Thank you!

Sponsor our Newsletter | Privacy Policy | Terms of Service