Jump to content

Display contents of a php file when included


shamilsons

Recommended Posts

Hello Everyone,

 

I have strange problem. I am using bluehost as my hosting service and php version: 5.4.27.

I have a file header.php which includes ufunc.php, the problem is the contents of ufunc.php are beign display in the browser why ?

 

header.php

<?php
session_start();

echo 'Current PHP version: ' . phpversion().'<br>';

//Creating proper path to configuration files
$incdir = "../config/";

//Including various files
include $incdir."ufunc.php";

...

?>

 

ufunc.php

Contains user-define functions

 

You can see problem here.

 

Can anyone help me what is the problem ?

 

Thank you

I guess I solved the problem,

unfunc.php -> the insides were like

 

function add($x,$y){

....

}

 

But I guess in php 5.4 we need to define php tags, because in one my application in php 5.2 it is working without defining the tags.

 

<php?

 

function add($x,$y){

....

}

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.