0

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.

6
  • Is safe mode on in the site that doesn't work? Additionally, what does open_basedir look like? Commented Mar 28, 2012 at 2:02
  • maybe your hosting is configurated to not show errors. You can try activating this using this line in the first line of your PHP file: ini_set ('error_reporting', E_ALL); Commented Mar 28, 2012 at 2:04
  • Are you reporting or/and logging errors? Perhaps you can check your error log or temporarily set error_reporting and display_errors. That line indicates that you are expecting something to be in your include path that may not be there, but I would assume you know that. Still, see what the include path is where you are trying to include the filename.php echo get_include_path();. Commented Mar 28, 2012 at 2:07
  • Does this work if you path it using a path from the document root? Commented Mar 28, 2012 at 2:08
  • @K.G. Yes, safe mode is turned on. Could that be causing the include problem? Commented Mar 28, 2012 at 3:07

1 Answer 1

1

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.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.