Search code examples
phpincludedir

Failed to open file for inclusion


I keep getting this error

Failed opening '/php/php_includes/easyCMSv2.php' for inclusion the file is from my admin panel that I am writing. The admin panel is located in a subdomain, and I need to reach back to public_html, so I do

include_once('../../../php/php_includes/configurate.php');

Yet I get the error for some inclusion. I am just trying to add files my directory looks something like this

 --public_html
   --css
   --php
     --php_includes
     --css
     --templates
   --js
   --administrator(sub-domain)
     --admin
     --{dynamic encoded path}
       --login.php 
       --testheader.php

login.php needs to include files from the directory php

I have been trying everything, yet I am missing more than hitting. Any words of advice from the wise. I'm tired of trying to work on this one little issue.


Solution

  • From the structure you posted you have too many step ups in your directory list. In cases like yours I always used

    echo get_include_path();
    

    with a good chance it is pointing to some totally different folder other than public_html.