Forum Moderators: coopster

Message Too Old, No Replies

Cant get php includes to work

         

Rightz

9:36 am on Feb 8, 2008 (gmt 0)

10+ Year Member



I've copied and paste the same page code from one side to another. The original php includes worked, copied onto another site they dont (you can see the includes in the course code).

Why not?

.htaccess on both sites:

AddType text/html .shtml .html
AddHandler server-parsed .shtml .html
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html .shtml

include code on both sites:

<?
include('menu2.shtml');
?>

I've tried using .php instead of .shtml, I've tried changing the .htaccess files.

Why should the same code work on one site and not the other?

Thanks

maxximus

10:27 am on Feb 8, 2008 (gmt 0)

10+ Year Member



What is being returned? error codes or a blank page.

If blank page is there anything in source code.

Need more info

Rightz

10:33 am on Feb 8, 2008 (gmt 0)

10+ Year Member



If you click on the source code you can see the php code. Not the normal html code within the .shtml file.

It is simply not reading the php.

I've been trying to figure this out for days so if anyone is prepared to look at my site plz pm me (can't post the link because of TOS)

maxximus

1:19 pm on Feb 8, 2008 (gmt 0)

10+ Year Member



Yes your script is not being parsed.

Notice your using short tags <? .Try using <?php instead (assuming php scripting is turned on with your new host).

Rightz

1:23 pm on Feb 8, 2008 (gmt 0)

10+ Year Member



Thanks. I've tired using?php as well but nothing. Should I contact my host again?

Rightz

8:07 pm on Feb 8, 2008 (gmt 0)

10+ Year Member



Bump

Can anyone help? Please!

g1smd

10:49 pm on Feb 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What is the name of the file that the include code is contained within?

Rightz

12:24 am on Feb 9, 2008 (gmt 0)

10+ Year Member



index.html

- everything works apart from the php (which shows in the source code when you right click)

[edited by: Rightz at 12:25 am (utc) on Feb. 9, 2008]

g1smd

1:16 am on Feb 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



AddType application/x-httpd-php .html

...should work as advertised.

Rightz

11:10 am on Feb 15, 2008 (gmt 0)

10+ Year Member




System: The following message was spliced on to this thread from: http://www.webmasterworld.com/php/3575626.htm [webmasterworld.com] by dreamcatcher - 11:50 am on Feb. 15, 2008 (utc 0)


Hi,

I am really sorry to bother you all but was wondering if I could ask for some help.

I still haven't sorted the problem in the following post:

[webmasterworld.com...]

I was wondering if you could take a look at my site and tell me where I am going wrong?

PM me for my site URL

You can see everything but the php - which is still in the source code.

Any advise would be REALLY appreciated!

Emma

PHP_Chimp

10:10 pm on Feb 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As this is a problem with 2 different servers the answer may be something to do with the host.

However you could try -
1) Check that


<?php
include('menu2.shtml');
?>

Doesnt fix the problem (I know that it has been suggested above, but check to make sure).
2) Does any php work on that other host? As it looks as though you are using SSI, this may not be anything to do with php.
3) If other php works then do any other includes? As it is possible for the directories that you are allowed to access to be limited. So you may need to put all of your includes in one directory and include them from that location. It may also be that you are not allowed any file type functions and that includes have been turned off.
4) Do the host where the include is not working allow .htaccess files? As it may be that the file is doing nothing. So stick a redirect rule in and test to see if it works.

I cant see anything wrong with the htaccess file, however it may be worth asking in the apache forum. As they may have a suggestion that we dont.

There are a few more things that may need checking, however that gives you somethings to check. Or you could just ask your host to have a look if they wont charge you.