rain13 Posted March 5, 2009 Share Posted March 5, 2009 HelloI have problem with calling php from htmls,I used example from this site.I would need some suggestions what to do.You can compare 2 files here (data in files are exactly same, only name is differenthttp://autoit.pri.ee/test/I tried this code. <html><body><?phpecho "Hello World";?></body></html> Link to comment Share on other sites More sharing options...
Jerry62704 Posted March 5, 2009 Share Posted March 5, 2009 HelloI have problem with calling php from htmls,I used example from this site.I would need some suggestions what to do.Direct URL to file, you can see the resulthttp://autoit.pri.ee/test/thisfile.htmlURL to snif ( you can use it to see that file is correct)http://autoit.pri.ee/test/I tried this code.<html><body><?phpecho "Hello World";?></body></html> Contact your ISP. Make sure PHP is on from their end. Link to comment Share on other sites More sharing options...
rain13 Posted March 5, 2009 Author Share Posted March 5, 2009 If I change *.html to *.php then it works,Here is example on same host.( it should show your IP)http://autoit.pri.ee/avatar.png/Here is clean pichttp://autoit.pri.ee/avatar.png/Avatar.png Link to comment Share on other sites More sharing options...
real_illusions Posted March 5, 2009 Share Posted March 5, 2009 You've just solved the problem :)For PHP to work, files need to have .php filenames, unless you use .htaccess to make php run on .html or .blah or .wibble filenames, or any filename you choose. Link to comment Share on other sites More sharing options...
rain13 Posted March 6, 2009 Author Share Posted March 6, 2009 You've just solved the problem :)For PHP to work, files need to have .php filenames, unless you use .htaccess to make php run on .html or .blah or .wibble filenames, or any filename you choose.I looks good idea,but what I have to exactly type in .htaccess file?I would like example please.Where I should put .htaccess file? in server root or in directory I have my html?Thanks Link to comment Share on other sites More sharing options...
Pollux Posted March 6, 2009 Share Posted March 6, 2009 I'd recommend sticking with using the .php file name extension for PHP files unless you have a good reason. The obvious reason for this is that if you're just learning PHP then it will help to keep things simple. The less obvious reason for this is that you then wouldn't be able to have .html files that don't require any PHP. You'll still be forcing these files to go through the PHP interpreter, adding an unnecessarily overhead.If you've got your mind set on using the .html extension for php files though...Go to the 'www' root (where your html docs are stored), look for a file called .htaccess. If it's there then edit it, otherwise create it. Insert these lines: RemoveHandler .html .htmAddType application/x-httpd-php .php .htm .html Bare in mind this is an apache feature and doesn't work on all web servers. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.