Question

Everything in my web app worked fine, until I moved it to a new domain. I set the include path as follows at the beginning of the script:

ini_set('include_path', $_SERVER['DOCUMENT_ROOT']);

The problem is:

  1. I am 100% sure that the include path is correct and all includes are used correctly
  2. Despite that, I cannot include any file. There is no error display, the files just are not executed (included)

To illustrate,

file_exists($_SERVER['DOCUMENT_ROOT'] . 'script.php') === true

but despite that the file script.php, located in the same folder as index.php, is not included:

include 'script.php';

Any ideas how to fix this? Thanks!

Était-ce utile?

La solution

You can check your apache error log for errors. There may be no errors shown on screen because it is disabled in PHP configuration (php.ini). To show errors on screen, you can set the error reporting on runtime

ini_set('display_errors', '1');
error_reporting(E_ALL);

or you can change their value in php.ini

If there are any fatal errors on your file (like parse error) the file wont get included. put a die like following after your include line to check if the script is running. If it is not then you have a problem on script.php

require('script.php');
die('test');
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top