Forum Moderators: coopster
I am a newbie to php and if this question is too stupid or if this is the wrong place to ask this kind questions ... please forgive ;-) But I am desperate and don't find anything nowhere.
Here is today's challenge: I want to write a simple html-page to get the first step in starting with php:
<html>
<body>
<?php echo "Hello World";?>
</body>
</html>
... when save it as "test.html", ftp it to my webhoster and open it via a browser, it is not giving any output.
First I thought that it would be the webhoster not having php active, but php is included in my hosting package and any .php script is working (they have the infophp.php in my main directory and I recently added a mail.php and both work properly). I have a second hoster for another project ... exactly the same situation: any .php is working, any <? php > in html is not :-(
What the heck am I doing wrong? I am at the end of my rope with getting that simple statement working. Maybe I have to add something in the header and tell the browser where to look for the server php installation?
Any help is highly appreciated!
Thanks
Benni
I modified my .htaccess so the files will be 'more SE friendly' by adding the following:
<Files *.html>
forcetype application/x-httpd-php
</Files>DefaultType application/x-httpd-php
Don't know if that is the best way of doing it or not but it is working for me... ;)
Hope it helps,
Matt
As Voltec said, somehow or other, you have to tell the server which files to treat as PHP. By default, this is usually only files that end in .php so you need to either name your files accordingly or adjust your server settings as Voltec suggested. Either method should work. If you don't have the right to make server settings in .htaccess files, then you'll need to just name the files .php
[edited by: ergophobe at 5:06 pm (utc) on Mar. 6, 2005]
<Files *.html>
forcetype application/x-httpd-php
</Files>
The only thing I am not sure is how to avoid overwriting anything which is already in there ... but most of the times there is nothing in there anyways.
If there is one there, be sure to download it first and then edit it. Some of my control panel settings modify mine, so I always download it first.
Have fun,
Matt