View Full Version : Need Help

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

<? include("file.php"); ?>
This .php file gets ecexuted successfully.

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

print $total1;
echo $total2;

But this .html file shows no output :(

Can anyone help me on this ?

09-04-2007, 11: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

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

09-04-2007, 12:53 PM
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.

09-04-2007, 06: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

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

09-05-2007, 01: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.

09-06-2007, 03: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....

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