PHP include doesn't work

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2012-04-08T17:24:23Z Indexed on 2012/04/08 17:29 UTC
Read the original article Hit count: 223

Filed under:

I'm not sure how simple is this to solve, but I assume I'm doing something wrong. I'm new to PHP, so bear with me, please.

When I started learning PHP, I always placed all my project files into the same folder along with index.php and thus included everything like this:

<?php
include('./translation.php');
?>

Later on in the process of learning as I gained experience and my skill increased, I had to start using folders and place my files into sub folders. I ended up successfully including my files with the following:

<?php
include('../translation.php');
?>

My trouble-free coding took an unexpected turn when I decided to start using sub-sub folders. After placing all the files even deeper into the file structure I was shocked to find out that I cannot include them anymore, using:

<?php
include('.../translation.php');
?>

Now I'm lost. What did I do wrong? Am I to understand that I cannot include files deeper than 2 directories in the project? Should I start using a different file system?

© Stack Overflow or respective owner

Related posts about php