...

View Full Version : Need Help



rashy
09-04-2007, 09:10 AM
I have a php file whose code is this...

<? include("file.php"); ?>
<?=$total1?>
<?=$total2?>
This .php file gets ecexuted successfully.

Now i want this code to be executed in HTML file:

<html>
<body>
<?php
include("file.php");
print $total1;
echo $total2;
?>
</body>
</html>

But this .html file shows no output :(

Can anyone help me on this ?

abduraooft
09-04-2007, 10:26 AM
Hello, a warm welcome to this forum!
It's better to ask this question like "How to execute php in html file".
Anyway, if you are trying on your local machine, you can accomplish this by adding a line to your httpd.conf (in xampp, it's in xamplite/apache/conf folder)
AddType application/x-httpd-php .htm near to the other lines like this. And then restart your server. (take a backup of your current file before going to modify and it's using notepad is good)

If you are trying on your server, please have a look at http://php.about.com/od/advancedphp/p/html_php.htm

rashy
09-04-2007, 11:30 AM
Thankyou abduraooft :)
I am doing this on a linux server but i cant see any .htaccess nowhere :(
What shall i do now ?

abduraooft
09-04-2007, 11:53 AM
If you are trying on your local machine with the default apache in Linux, try to locate your apache-config file named httpd.conf.
It'll be somewhere


* Red Hat / Fedora Core / CentOS: /etc/httpd/conf/httpd.conf or /etc/httpd/conf.d/application.conf
* Novell SuSE: /etc/apache2/httpd.conf or /etc/apache2/conf.d/application.conf
* Ubuntu (dapper 6.06) / Debian: /etc/apache2/apache2.conf or /etc/apache2/conf.d/application.conf


If you are trying to make it work on your website, then create a file named .htaccess having a single line as specified above and then upload it to your directory where your file is located.

rashy
09-04-2007, 05:41 PM
I get the following error now :(


Warning: include(folder/file.php) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /.../user/htdocs/index.htm on line 146

Warning: include() [function.include]: Failed opening 'folder/file.php' for inclusion (include_path='.:/usr/share/pear-php5') in /.../user/htdocs/index.htm on line 146

Notice: Undefined variable: total_uniques in /.../user/htdocs/index.htm on line 147

rashy
09-05-2007, 03:10 AM
abduraooft please can you help me on this:confused: Please :(

abduraooft
09-05-2007, 12:47 PM
I get the following error now :(
[code]Warning: include(folder/file.php) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /.../user/htdocs/index.htm on line 146


Is it caused by the above updation? I think this error due the mismatch in address that you've used to refer the file.php and it's actual path with respect to your current file.

Currently I'm working on windows with xampp, and I did the trick by .htaccess in a website and by httpd.conf in my local server.

rashy
09-06-2007, 02:50 PM
abduraooft i am making all these changes at my server(website) which is running on Linux on the index.html page which is referring to a file.php inside a folder so i use require(folder/file.php) but no luck :(
Please help me....

Update:
abduraooft now i copied all the contents of folder to the same directory ...
Now all of the stuff works fine thanks :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum