Jump to content

php require_once not working


dfqaz

Recommended Posts

im writing php application in windows 7 using apachi . iwant to include php file to another php file. This is the code.

test.php

-------------

before

 

<?php require_once 'footer.php'; ?>

 

after

 

 

fotter.php

--------------

test 1 ------------------------- test2

 

 

when I include the above footer.php into test.php file I got the following result.

 

 

before

 

<?php require_once 'footer.php'; ?>

 

after

 

Could you please tell me wher i goes woring?

Link to comment
Share on other sites

@anupamsaha

when I type ur code in top of my code. It removed code

Put the following at the top of your PHP code and see what errors are you getting:

 

error_reporting(E_ALL);
ini_set("display_errors", 1);

 

Thanks!

 

Thanx. When I insert ur code  I got only the `before` and `after` words without

<?php require_once 'footer.php'; ?>

. But it is not included my footer file.

 

This is my code agin...

 

 

test.php

before

<?php require_once 'footer.php'; ?>

after


 

footer.php

test 1 ------------------------- test2 

 

 

results ahould be

before
test 1 ------------------------- test2 
after

 

Please help me...

Link to comment
Share on other sites

In order to run PHP code on your computer you need to install a http server (IIS or Apache) which is configured with PHP. Simply just loading test.php directly into your web browser will not work.

 

If you have installed a Server that is configured with PHP then make sure you are saving the php files in your servers root folder and going to http://localhost/test.php to run it.

 

 

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.