Forum Moderators: coopster

Message Too Old, No Replies

PHP includes not working properly...

.htaccess?

         

madcat

12:02 am on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's up you guys-

Having a huge problem trying to get my php includes to operate within .html pages.

All of my pages have the .html extension...each page has <?php include...?>. My Web server has just undergone some configuration- and .htaccess no longer works the same. I get blank spots on screen where my includes are now...I know that php is working and installed.

My .htaccess looks like this...

AddType text/css .css
AddType application/x-httpd-php .php4 .php .htm .php3 .inc .html

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

Each time I add this file to the correct directory- I try and access the site only to be asked if I want to download the site.

When I remove the file, I can access the site once again- but the .inc's are still missing. The files haven't been changed since before the config- when everything was good in the hood.

I just need to get these includes working, any help is greatly appreciated.

jamesa

9:54 am on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Apache can be set up to disallow .htaccess files. If your .htaccess file don't work at all (can't password protect a directory, etc) then you might want to check with your host and see if they changed anything.

vincevincevince

1:37 pm on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know what the problem is, but here are some suggestions:

1) Change your include($path) to a full server path eg. /usr/www/siteid/includes/file.inc
2) Copy/rename a .html file to .php and see if it now works - if it does then you may be able to work around the whole problem using mod_rewrite
3) When it prompts you to download the site - go ahead and save the file - and open it within your favourite text editor - what is it that has been downloaded?

madcat

8:40 pm on Sep 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok-

1) Doesn't work...

2) Corrects the problem. But shouldn't I be able to use php within .html files? My host hasn't gotten back to me yet about why .htaccess causes number 3.

3) I save just the page I go to...index.html. When I open it locally- it lacks any CSS styles and just gives me the bare bones information.

Thanks again.

M

vincevincevince

9:39 am on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In that case I'm afraid I'm unable to advise you further, sorry. I hope someone else can help. It may help your host if you prepare them a simplest possible example, e.g. a .html page containing <html><body><?php echo "php working";?></body></html> or similar... (or if echo works, then a simple include statement...

gethan

9:49 am on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think a little more information is needed...

Do you get any error messages?

Can you open the files you wish to include directly from the browser?

eg. if your include file is include.html does [example.com...] open it?

Do your include files live in the document root or a sub directory?

madcat

11:46 am on Sep 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



gethan- you fixed it...

Thanks for all your help vincevincevince and jamesa. I put the .htaccess file in my includes directory itself. Rather than the 'www'. Of course that is different than before- Last time I put the file in the 'www' directory and all was fine. I thought it effected the directory and all sub-directories unless another .htaccess file was involved in that sub...ah, i don't know.

Thank Again-