ispCP - Board - Support
html extension with php - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: System Setup & Installation (/forum-32.html)
+--- Thread: html extension with php (/thread-5915.html)



html extension with php - coper - 03-04-2009 02:50 AM

Hello
I'm trying to run html extension files with php code inside it. I can do it adding this lines to the htaccess file
Code:
AddType application/x-httpd-php .php .htm .html
AddHandler x-httpd-php .php .htm .html
But with this the output of a mysql query is empty or there is nothing printing in the page. Using the same file with the mysql query but changing the extension of the file to php I can see the output line of the query without problem, so the query is ok.
Now I want to try to add this lines to the apache config
Code:
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .html
AddType application/x-httpd-php-source .phps
</IfModule>
But I don't know in which config file I need to add it. Can you tell me that?
And if you had the same problem with the html extension and php code please tell me too.

Thanks for your help.

Greetings.

c.


RE: html extension with php - coper - 03-04-2009 03:58 AM

I found the file to add that lines but still don't work.
Anyone knows how can I do to use php code inside a html file?
I can do it adding this to a htaccess file
Code:
<FilesMatch "\.(htm|html|php)$">
SetHandler application/x-httpd-php
</FilesMatch>
php works but I get Fatal error: Call to undefined function: mysql_connect()
And if the file has php extension I don't get that error.


RE: html extension with php - la1o - 03-04-2009 12:22 PM

you dont need do that, only need to use mod_rewrite
for example

RewriteRule (.*)\.html$ $1.php [L]

maybe that works better


RE: html extension with php - coper - 03-04-2009 10:06 PM

Thanks for the answer
I will try to do what you said. Please can you tell me where I need to put that?


RE: html extension with php - la1o - 03-05-2009 02:13 AM

in your .htaccess or apache conf


RE: html extension with php - coper - 03-05-2009 03:05 AM

I did it but I don't know what is wrong. When I put that in the htaccess file I go to the url of the site and the internet browser want to download a file without extension and with the name of the site. I downloaded the file and opened it with a text editor and I saw the html code.

I have no idea why this happens. Another suggestion?

Thank you again.


c.


RE: html extension with php - la1o - 03-05-2009 04:42 AM

for example

i visit http://dom.cl/test.html

but with this rule RewriteRule (.*)\.html$ $1.php [L]

i really enter to

http://dom.cl/test.php

so test.php must exist and not test.html file
you maybe need to read about mod_rewrite

(sorry for my english)


RE: html extension with php - coper - 03-07-2009 05:58 PM

I need a different thing. There isn't php files in the website, I only have html files. So what I need to do is to run php code inside html files. I need html files to understand php code.


c.


RE: html extension with php - kilburn - 03-10-2009 02:31 AM

Try adding the following to /etc/apache2/ispcp/domain.tld.conf
Code:
<IfModule mod_fcgid.c>
  AddHandler fcgid-script .html
</IfModule>



RE: html extension with php - coper - 03-13-2009 04:03 PM

Didn't work.

I had to use an iframe to insert the php file with the code. That was the only way. Anyway I wish I could write php code in html files. Still looking for a solution.

Thanks a lot for the help.

Regards.

c.