neugi Posted June 30, 2006 Share Posted June 30, 2006 Hi, what do i have to change that php code works in html also?best Quote Link to comment Share on other sites More sharing options...
fert Posted June 30, 2006 Share Posted June 30, 2006 use change the file extension to .php and then you can use php and html Quote Link to comment Share on other sites More sharing options...
Unseeeen Posted June 30, 2006 Share Posted June 30, 2006 read up on mod_rewrite in .htaccess files. Quote Link to comment Share on other sites More sharing options...
php_joe Posted June 30, 2006 Share Posted June 30, 2006 [quote author=fert link=topic=98964.msg389509#msg389509 date=1151651557]use change the file extension to .php and then you can use php and html [/quote]I think he means without changing the extension (for example: so it runs on a website that is not php enabled, such as geocities).I've heard that you can do this with JavaScript. They always say to use this:[code]<script language="javascript" src="http://whatever/php_script.php."> </script>[/code]But that's never worked for me. I've also seen this suggested:[code]<img src="php_script.php" />[/code]But I only get a red X when I tried it.Feel free to try them if you like.I did find a JavaScript snippit that did return the php output, but only the output from the php file and nothing from the original html webpage (no code... nothing). Not only that, but when I tried to refresh the page (after deleting the JavaScript) it wouldn't change. The php output always showed up even with no code in the html file and the php file renamed!I'm also interested in a way to display a php output on an html page (aside from using an iframe) on a server such as geocities that doesn't support php.Joe Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 30, 2006 Share Posted June 30, 2006 just change the file exstention as advised ok. Quote Link to comment Share on other sites More sharing options...
neugi Posted June 30, 2006 Author Share Posted June 30, 2006 i want that the extension html is prasing the php code ;)i've got my own server where i can change everything, also the php ini. i only need to know which of them i've to change. best Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted June 30, 2006 Share Posted June 30, 2006 If you want your PHP code to be parsed in a HTML file you need to edit the servers config file. Such as for Apache you need to find a file called httpd.conf. Look for a a line like this:[b]AddType application/x-httpd-php .php[/b]Now add a space after [i].php[/i] and add .html to the end. Save the httpd.conf file restart Apache. You should now be able to parse PHP code in your html files. Quote Link to comment Share on other sites More sharing options...
neugi Posted June 30, 2006 Author Share Posted June 30, 2006 i've searched for this file, but haven't found what i'm looking for. this is in the file:[quote]# This is here for backwards compatability reasons and to support# installing 3rd party modules directly via apxs2, rather than# through the /etc/apache2/mods-{available,enabled} mechanism.##LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so[/quote]i've also searched for files containg a string like the one you told me, but nothing therebest Quote Link to comment Share on other sites More sharing options...
xyn Posted June 30, 2006 Share Posted June 30, 2006 I discovered something about this the other day.. I'm not sure if it works but try this:<!DOCTYPE PHP PUBLIC "-//W3C//DTD php Transitional//EN">I'm not sure if that is 100% correct, otherwise just use the .php extension as advised. Quote Link to comment Share on other sites More sharing options...
Koobi Posted June 30, 2006 Share Posted June 30, 2006 what version of Apache are you on?I believe Apache 2 uses apache2.conf instead of httpd.conf it's generally located in /etc/apache2/apache2.conf[b]generally[/b], all configuration files are located in the /etc/ folder Quote Link to comment Share on other sites More sharing options...
neugi Posted June 30, 2006 Author Share Posted June 30, 2006 Hi, version ist: Apache Version 2.0.54best Quote Link to comment Share on other sites More sharing options...
Koobi Posted June 30, 2006 Share Posted June 30, 2006 [quote author=neugi link=topic=98964.msg389663#msg389663 date=1151675193]Hi, version ist: Apache Version 2.0.54best[/quote]ok thanks.did it occur to you that you should have perhaps tried looking for apache2.conf? :) Quote Link to comment Share on other sites More sharing options...
neugi Posted June 30, 2006 Author Share Posted June 30, 2006 i'm new to linux ;)now it works i've also to remove the # in from of it ;)best Quote Link to comment Share on other sites More sharing options...
Koobi Posted June 30, 2006 Share Posted June 30, 2006 Glad you sorted it out :)I will move this topic to the Apache Server section because people are more likely to search for something like this in that forum. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.