View Full Version : Test For Php Includes

11-30-2006, 09:08 PM
I am having a few problems trying to get my php includes showing on my page.

Is there any easy/basic code I can insert on a page to test whether it is really working. The package I get from my host does allow php includes so there shouldn't be a problem there?

12-01-2006, 01:59 AM
Are you inserting the php code in an HTML page? (.htm or .html extension)

If so you need to set up the .htaccess to read html as php.

12-01-2006, 02:13 AM
Not real sure if you meant a basic snippet of an include tag but here is what it should look like.

<?php include("PATH/TO/FILE.php");

Good Luck!

12-01-2006, 02:37 AM
Something else to take into consideration, are you trying to include a plain text page, or another PHP file. If including another PHP page, does that page echo any text at all? If it doesn't and you want to see if it is working at all, make a php file echo some text and try that. Hope this helps a little.

12-01-2006, 04:38 AM
Make two files-- test.php and test.htm


it works

<?php include('test.htm'); ?>

Run test.php

Also, assuming (or to check if) php is installed on your server, run this to check all the various settings and such--

<?php phpinfo(); ?>
That's it. It'll generate a very long html page with tons of values... but for now just notice things like if safe mode is enabled, what version you have, what the server environment is like, etc.