user1108996
user1108996

Reputation: 285

PHP include not working from other directory

I have a small PHP application that works fine on many hosting accounts and on my local server.

I'm trying to set it up for a client but the includes don't seem to work. If I am inside the application directory, all includes work fine but if I try include a file from inside this directory into a file that is located outside of this directory, it is not included. I get no errors. The php file is just not included.

I have the very same setup on other accounts and everything works fine. I am thinking that it may be some security permission settings or php.ini configuration issue.

Since I don't get any error, I don't know where to start looking. The include look like this:

<?php require_once('foldername/foldername/filename.php');?>

How can I start investigating where the problem is?

Thank you very much.

Upvotes: 0

Views: 192

Answers (1)

Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57640

This can happen if your include_path is not proper. Make sure

  1. . is in your include_path
  2. If foldername/foldername/filename.php is in /path/to/project directory so it forms /path/to/project/foldername/foldername/filename.php, put /path/to/project in your path.

Upvotes: 1

Related Questions