ingepo
01-12-2003, 10:32 AM
I just read my first PHP tutorial yesterday.
I uploaded a file index.htm to my /public_html/0php folder on my web server.
Here is the code in that page:
<html>
<body bgcolor="white">
<strong>How to say "Hello, World!"</strong>
<?php echo "Hello, World!";?>
<br>
Simple, huh?
</body>
</html>
I noticed the PHP does not get parsed :( The page just displays the HTML content normally without the words "Hello. World!"
Then I renamed the page to index.shtml.
Still no results.
What am i doing wrong?
aah-jim
01-12-2003, 10:36 AM
rename the file to index.php
ingepo
01-12-2003, 10:43 AM
it worked like a charm!
btw... does every file always need to be having the .php extension if i want it to parse PHP cdie inside it?
also, cannot .shtml extensions be used ever?
MarkIL
01-12-2003, 10:47 AM
You can add any type of extension to the list of extensions to be parsed by PHP; Simply add the line
AddType application/x-httpd-php .html .shtml
etc
to your .htaccess or httpd.conf.
ingepo
01-12-2003, 10:51 AM
so if i wish to add four extensions, i add them all one one line as in your example? or do i need to add them individually per line.
i will be using .htaccess. i believe it should be in the root folder, yes?
where can i find the file httpd.conf?
thanks for helping me.
aah-jim
01-12-2003, 10:56 AM
if you have cpanel you can login into your control panel and then click on mime types,
and then add the application: application/x-httpd-php to as many extensions as you like
ingepo
01-12-2003, 12:57 PM
yes... i have cpanel access.
so if i click on Mime Types and add the .htm, .html. and .shtml extensions, my other .htm pages (which do not contain any PHP code) will continue to be rendered normally as before? right?
Yes, but with a slight performance hit for each page. The PHP parser needs to look at every page served...
ingepo
01-12-2003, 04:27 PM
ahaa!!!
that's important... thanks for mentioning this.
kkbbzzaa
03-11-2003, 12:40 AM
ingepo, what tutorial are you taking to learn php? I want to learn too, but no idea where to start.
Thanks, any more suggestions will be kindly received.
officer
07-15-2003, 11:11 PM
some excellent suggestions on PHP tutorials are in this thread:
http://www.webhostingtalk.com/showthread.php?s=&threadid=102631