Question

I was using Apache before setting up my new website. With Apache the whole code worked well so this is something with Nginx. Now I'm using Nginx and there were some difficulties that I got to fix. But now I ran into some trouble.

I created a test.php so you can easily see what's going wrong. In the file there is just:

<?php
include 'graph.php';
?>

In the graph.php there is just some PHP code which usually is need to show some graph stuff. That does not matter. What matters is that this code should never be posted or printed out. When I replace the include statement with just the code that is in the file it works. So why does include or even require_once not work properly for me?

Added graph.php code for you

Alright just added the code of the graph.php here:

<?php
# set header layout
include 'inc/header.php';

# get parameters year/month of calendar 
$date_d=0;$date_m=0;$date_y=0;
if (isset($_GET['d'])&&isset($_GET['m'])&&isset($_GET['y'])) {
  $date_d = $_GET['d'];
  $date_m = $_GET['m'];
  $date_y = $_GET['y'];
} 
# show diagram of actual statistic overview
echo "<img src='myimage.png' alt='statistic'>";

include 'graph/mycalendar.php';

# set up a date if nothing is set
$actualdate = getdate(time());
if ($month == "")
  $month = $actualdate["mon"];
if ($year == "")
  $year = $actualdate["year"];
# get parameters year/month of calendar 
if (isset($_GET['month'])&&isset($_GET['year'])) {
  $month = $_GET['month'];
  $year = $_GET['year'];
} 

$mycalendar = new MyCalendar;
echo $mycalendar->getMonthView($month, $year);

include 'graph/graph.php';
include 'inc/footer.php';
?>
Was it helpful?

Solution

include 'graph/mycalendar.php';

That file stated with

<? 

and with

<?php 

it now works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top