Jump to content

Display contents of a php file when included


shamilsons
Go to solution Solved by 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

Edited by shamilsons
Link to comment
Share on other sites

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){

....

}

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.