-
File Includes
I have the majority of my files in the root directory of the website with a include directory for any file includes needed.
This works fine using:
Code:
include('include/file.php');
However I also have another directory that contains files that also need these include files. I would have thought the following would work:
Code:
include('../include/file.php');
But I get a Fatal error: Maximum execution time of 30 seconds exceeded in C:\home\****\include\file.php on line 10.
On line 10 is the following code which works fine apart from when this include file is called in anything other than the root directory.
Code:
Line 10: session_register("s_custid");
Help appreciated.
DJ
-
why not just make a var like so
$the_file = $_SERVER["DOCUMENT_ROOT"]."/include/file.php";
of course change the paths to suit your needs
-
I've tried that but $_SERVER["DOCUMENT_ROOT"] returns nothing i.e. "".
Plus the error isn't (I don't think) related to not finding the file its just it times out for a page in a directory and not one in the root directory.
DJ
-
The maximum execution time is to stop PHP becoming a runaway process. Is there any code in your scripts which could cause them to hang? e.g. infinite loops etc ...
I would advise you add some debug echo statements to track down the exact point where the script hits a bottle kneck, you'll be half way toward solving your problem then.