0

I am trying to include the files in the php files to my ajax called function.

the way I have written the code is

define('ROOT_PATH', dirname(__FILE__)); require_once ROOT_PATH. '/lib/dao/SqlFun.php'; require_once ROOT_PATH. '/lib/Templates/apply.php'; 

But its generating the error saying

Warning: require_once(C:\Program Files...

Fatal error: require_once() [function.require]: Failed opening required "filepath.php".

But all those files are there in my project folder itself.

What might be the problem here. If its wrong way then which is the right way to do this.

Thanks in advance.

2
  • 2
    echo ROOT_PATH. '/lib/dao/SqlFun.php'; and match the actual location of file with one returned by this echo statement. Commented May 28, 2011 at 10:28
  • Ya @Shakti Singh, I am able to get the path using the echo statement Commented May 28, 2011 at 13:34

1 Answer 1

1

Having your php and other web related files in a sub-folder of C:\Program Files\... is a bad idea I guess. There will be permission problems in Visa and Seven because these folders require Administrator privileges which Apache lacks (As far as I know). So what you can try is, try to run Apache as admin. If that works then you might like to put your web related files in some other folder.

Sign up to request clarification or add additional context in comments.

3 Comments

I have given all the permissions.
Ok. What Shakti Singh means in his comment is that you verify that respective files really exist at printed locations. E.g. if it echoes C:\Program Files\some\folder/lib/dao/SqlFun.php, go to Start>Run and type in C:\Program Files\some\folder\lib\dao\SqlFun.php (replacing forward slashes to back slashes) and see if it opens the file or gives error. The error will tell you what's going on.
I have changed from forward slashes to back slashes. in Start>Run that path opens it but still I am getting the error in the php.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.