Forum Moderators: coopster
Made a text file called .htaccess.txt put in the following
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
Uploaded it my root directory, same as files to be parsed, I have 8 files here as follows
1)test.php (<? phpinfo();?> ) this is to test PHP is working. Okay PHP 4.3
2)faster.php (test to makes sure php is working) Okay
I have tried the following set ups / combinations:
3)faster.htm normal auction template, where content should go I have inserted <?php include 'fasterinsert.php';?>
4)faster.htm normal auction template, where content should go I have inserted <?php include 'fasterinsert.html';?>
5)faster1.htm normal auction template, where content should go I have inserted <?php include 'fasterinsert.inc';?>
6)faster1.htm normal auction template, where content should go I have inserted <?php include 'fasterinsert.htm';?>
7)fasterinsert.html insert to replace content in auction template
8)fasterinsert.php insert to replace content in auction template
As you can see there are no restrictions on me using .htaccess.
You can add an .htaccess file if you want, but the former set of directives are redundant (.shtml files are already parsed as SSI), and the latter set just won't work. (not sure what this means)
Changed .htaccess.txt to .htaccess tried chmod to RW/R/R also left it blank, but still I can not get the file fasterinsert.php or .html to appear in any of the files listed above.
PLEASE, PLEASE what am I doing wrong? It has taken me three days to try and crack this but it will be worth it.
Hope you can help
[edited by: coopster at 4:13 pm (utc) on Aug. 21, 2004]
[edit reason] linked up url reference [/edit]
As you can see there are no restrictions on me using .htaccess.
Actually, I can't see that, which is perhaps good news, perhaps bad
If the server is set to parse *.php as php, and you are trying to make it parse *.html as php, it would appear that the .htaccess is not working. If you take away the .htaccess file, do your *.php files (i.e. the first two cases) still work? If so, then the .htaccess isn't doing anything.
Tom
Thanks for your reply I have removed the .htaccess file and the page (template) will now load where all that was happening was that the page would come up blank and the page would try open my download program but even though the page now loads into the browser where the content should be it's just blank, don’t know if this info will help but below is from my host tech dept
You can add an .htaccess file if you want, but the former set of directives are redundant (.shtml files are already parsed as SSI), and the latter set just won't work. (Not sure what this means)
Robert
There may be a directive to parse your html files as SSI's (id guess in http.conf if its not in your .htaccess). remove that and apache should recognise that html should be parsed through php
brotherhood of LAN
Sorry which is it I remove, I have already moved the .htaccess and the normal php pages load no problem, so what do I remove now is it the hhtp.conf? If so where do I find it and can I move it with out a problem?
ergophobe
Both 1 & 2 work and with and without .htaccess. I have tried both versions of .htaccess, as shown by oilman & henry0.
Help guys and gal’s , three days lost and none the wiser
Robert __In the words of the late Great Freddie Mercury (I'M GOING SLIGHTY MAD)
There's something in the http.conf that lets .html extensions include SSI. I had the same problem you mention, after removing this part of in the http.conf my problem was solved (maybe ergophobe knows the part of the file I mean).
I assume there's some kind of conflict in letting .html be parsed for SSI's by Apache and also by PHP. After I changed my http.conf to disable SSI capability in .html , PHP parsed the .html as normal.
Correct me if I’m wrong but to use ssi scripts I would need to rename my pages shtml, but if I was to be able to rename them I would renamed them .php right at the beginning.
Here is a brief recap on what I am trying to achieve, I use templates in auction sites, with content these are to big to list (restrictions) have tried using iframes but does not allow the template to restructure it’s self (self adjusting table frame) so after reading up I believed that I could use the php include link, but if you read back through I believe I have tried everything there is to try. Unless someone knows otherwise?
This is no longer a project this has now become an obsession!
Is there anyone out there who can help?
Robert
httpd.conffile. You said you "have contacted tech support", so I am assuming you are on a shared host. Knowing that, you probably aren't going to have access to the Apache
httpd.confconfiguration file as most hosts don't allow this. Also, it sounds to me like they have configured Apache Server-Side Includes (SSI) for you and have instructed you to save any files that you want parsed in this manner with a
.shtmlextension. So, in part, your following statement...
>>Correct me if I’m wrong but to use ssi scripts I would need to rename my pages shtml...
is true because your host has it setup this way for you. However, you asked to be corrected if you were wrong, so you're going to be corrected... ;)
First off, it's highly unlikely you are even going to need to be concerned about Apache SSI in this case, so if you don't want to use it or don't care to learn about it, skip down to the horizontal rule below and forget this section. Otherwise, let's clear the confusion on SSI. The default SSI configuration for Apache is as follows:
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
Then, to use SSI, we simply uncomment the configuration directives and name any file with a server-side include in it with a
.shtmlextension. Great, good to go. But, let's say I decide that a certain special folder on my site I want to have files with a
.coopsterextension that have server-side includes to be parsed by Apache and then assign the resulting document the mime type of
text/html. I can create a per-directory override file (
.htaccess) as follows...
Options +Includes
AddType text/html .coopster
AddOutputFilter INCLUDES .coopster
...then, I drop that
.htaccessfile into my special directory. Next, I create an HTML file that has an Apache SSI statement in it and save this file with a
.coopsterextension in the special directory. That's it, I'm good to go. If I request that file in my web browser, I'll get the document with the SSI code parsed and dished up as
text/html. So you see, you can actually tell your server to parse server-side includes any way you want, simply by modifying the extension in that Apache configuration directive.
Apache has a Tutorial: Introduction to Server Side Includes [httpd.apache.org] if you want to learn more. However, since you are using PHP, do you really need to use SSI? No. PHP is a server-side language, doing at least what Apache's SSI can do and then some. And this is an understatement! So, let's just forget about Apache SSI for now and focus on the PHP part.
>>...but if I was to be able to rename them I would renamed them .php right at the beginning.
What you really want to do here is parse other files as PHP, including
.htmand
.html. If your host is running PHP as module, then all you need to do is create a per-directory override file (
.htaccess) with a single line in it.
AddType application/x-httpd-php .php .htm .htmlIf this does not work, then your host is not allowing overrides.
If your host is running PHP as a CGI binary, then we'll have to look at things a bit differently.
I have listed below all correspondence from the tech dept at my hosting company maybe this will help.
And as I have said before I really appreciate your help.
Robert
***************************************************
<snipped email reference as per TOS [webmasterworld.com] #9>
[edited by: coopster at 6:20 pm (utc) on Aug. 21, 2004]
[edit reason] Using email snippets [webmasterworld.com] [/edit]
Try the single line file that I referred to in the latter half of my last post. When you save it, save it as
.htaccessWITHOUT any extension, including
.txt!
Here is the predicament I have?
I sell items through various auction sites, I use a template for all sites (uniformity / corporate image) the template alone is 19kb; most sites have now put restrictions of 30kb. After putting in contents / description on most occasion I am now exceeding the 30kb limit, for example 45kb.
I am currently using iframes, these work but have restrictions I have to set the size for the table where it is to load, e.g. height=2900.
Now I have tried using php, using the <?php include 'fasterinsert.php'; ?> I have also tried using .htm / .html /. Inc but nothing works?
As I cannot rename the auction template .php as the only thing that is inserted in to an auction is HTML text, I need to try and set a link between the auction template page on the auction site and the php insert on my site.
I have checked with the tech dept of my hosting company, which and I have a resellers account so very few restrictions.
My intentions are to build a database of auction stock and have just one template page changing just a few lines, when stock changes.
Here is the reply from my tech dept.
You can add an .htaccess file if you want, but the former set of directives are redundant (.shtml files are already parsed as SSI), and the latter set just won't work.
You can include a PHP script from within an HTML page by using SSI, or by renaming the HTML file to .php and using the kind of code you quote above. The one thing that's not feasible to is run a file that ends in .html through the PHP.
So if any one can help I would forever grateful.
Robert
Here are the tasks I have just carried out but with no joy
Copied the script into a word pad saved as .htaccess and then used terrapin ftp program to move on to the home server saved in the root directory (public_html) saved as .htaccess,(removed .txt prefix) refreshed saved again for good luck.
Loaded htm page which has the following <?php include 'fasterinsert.php'; ?> inserted in to the body.
When I try to open the htm page, I get the (Action cancelled) page and download program opens up?
Robert
.htmextension with PHP. Create another file with only the following code in it.
<?phpNow...
phpinfo();
?>
myphpinfo.htm
http://www.example.com/myphpinfo.htm
myphpinfo.htmto
myphpinfo.php
http://www.example.com/myphpinfo.php
Hopefully, it's a page loaded with the PHP installation information and more. If so, then we are parsing PHP correctly at the server.
myphpinfo.htmagain.
You have another file in the same directory as that file named
.htaccess(with no extension, just dot-h-t-a-c-c-e-s-s). If you open that up and look at it, it should have only one line in it, correct? The
AddTypedirective shown earlier. Can you confirm?
.htaccess) files. Hopefully they have the AllowOverride [httpd.apache.org] directive set accordingly...
If this single line
AddType application/x-httpd-php .php .htm .htmldoesn't parse the
myphpinfo.htmfile as PHP then we've gone beyond a point that I can help without access to the server.
Came across this, not sure if it has any relevance?
Is PHP a CGI or Apache module?
PHP runs as a cgi at <snip>Example<snip> Internet – this is because it is more secure than running it as an Apache module (if it runs as an Apache module PHP runs as the same user with the same rights as Apache).
[edited by: coopster at 10:39 pm (utc) on Aug. 23, 2004]
[edit reason] removed specifics [/edit]
You still have options here, but you are going to have to find out the handler name (if the hosting provider didn't use
php-scriptby default) and use an
AddHandlerdirective instead.
Action [httpd.apache.org] php-script /cgi-bin/phpResource:
AddHandler [httpd.apache.org] php-script .php
Note:
You would use this rather than the
AddTypedirective in your
.htaccessfile.
Can I say firstly a big thank you for all the time you spent trying to get my problem sorted out, but after all that it does not work?
Let me explain I have to parse using SSI so after a lot of tweaking, it worked, well sort of? It worked when I have all files and folders on the same server, and use this directive to call the page <!--#include virtual="inserts/binoinsert.htm" --> but refused to work when I tried to move the folder to another server, and had this as the directive <!--#include virtual="http://www.abc.com/inserts/binoinsert.htm" -->
I just get this error [an error occurred while processing this directive]?
So if anyone can come up with a suggestion to this nagging problem, I am open to any suggestions.
Robert
If you need to get the info from a different server, you'll have to perform your fetch operations in a cgi script local to the server. Either that or switch this Apache SSI to a PHP include() [php.net] function.
We have been down the php road, that’s what brought us onto the ssi track.
I was sent to the include link by my web host, But I am either more stupid than I look or the obvious is looking me in the face but I can’t see it?
Could I ask for a little more help, I know that you don’t learn if others do, but a little hint like how do I set up the include link, without using http etc? And what do I have to do with a local cgi script?
Robert