0

Is there any way to determine the file which has called one other. E.g.

FILE one.php:

include('two.php');
...

FILE two.php:

// This file do some stuff

I'm getting a 500 internal server error on two.php (unexpected end of file in two.php).

However, the file has not an unexpected EOF, so I'm guessing that the issue comes from the file one.php. The problem is that I don't know which is that file. Any ideas?

Manolo
  • 24,020
  • 20
  • 85
  • 130
  • Possibly duplicate of http://stackoverflow.com/a/5204873/1938163 – Marco A. Feb 08 '14 at 11:26
  • possible duplicate of [Can an included PHP file know where it was included from?](http://stackoverflow.com/questions/5204830/can-an-included-php-file-know-where-it-was-included-from) – Marco A. Feb 08 '14 at 11:27

2 Answers2

1

You dont care about what file is calling the other one, since PHP parses the file by itself, so the problem is in you second file.

Take a look at a few things:

  • check if your php tags have spaces after and before, i.e, change {?> whith this { ?> or <?phpSOMETHING with <?php SOMETHING
  • Update: if you dont have short_open_tag on, change any <? for <?php
  • Also, carefully count all your curly braces { and } and check that everything is closed properly.
  • Do the same with single ' and double " coutes.

If you post the code of your file we can better help you out

Carlos Robles
  • 10,828
  • 3
  • 41
  • 60
0

I had a similar problem long time ago. The problem was a <? PHP opening tag.

Solved just replacing <? with <?php

Manolo
  • 24,020
  • 20
  • 85
  • 130