Can't run PHP Code into a .html file.

ctinx10m

New Member
Messages
12
Reaction score
0
Points
1
Hi guys,

I was trying to run PHP into my .html file like that:
<td>
<?php
echo "success";​
?>​
</td>
I did put this simple echo to test if my php work, but nothing happen and I saw my .html source with my navigator, and my php Code appears commented as <!-- ... -->

I've been searching from everywhere and I found my problem is .htaccess, I'v tried everything, see:

#AddHandler application/x-httpd-php54 .html .htm
#AddType application/x-httpd-php54 .html .htm

#RewriteEngine on
#RewriteRule \.(html|htm)$ - [T=application/x-httpd-php]
#RewriteEngine on
#RewriteRule \.(html|htm)$ - [H=application/x-httpd-php]

#<FilesMatch "\.(html|htm)$">
#ForceType application/x-httpd-php5
#</FilesMatch>
#AddType text/html .shtml .shtm .htm .html

#AddType application/x-httpd-php .php .html
#AddHandler server-parsed .shtml .shtm .htm .html
#Options Indexes FollowSymLinks Includes

# Uncomment the version of PHP you have on your server
# Only one of the following can be uncommented
#AddHandler application/x-httpd-ea-php70 .html .php .htm
#AddHandler application/x-httpd-php5 .html .php .htm
#AddHandler application/x-httpd-php52 .html .php .htm
#AddHandler application/x-httpd-php54 .html .php .htm
#AddHandler application/x-httpd-php4 .html .php .htm

#AddType application/x-httpd-php .php .html
#AddHandler application/x-httpd-php .htm .html
#AddHandler application/x-httpd-php5 .html .php .htm

Of course without "#", and nothing happen but sometimes when I refresh my page with new htaccess modifications my navigator ask me if I want to download the .html, but still nothing happen.

And I really don't know what to do now.

Note: When I've been searching from x10hosting forums I saw the default php versión is 5.4, I think 'cause am not sure.
 

spacresx

Community Advocate
Community Support
Messages
2,182
Reaction score
195
Points
63
i had a similar issue (not exact) with php before.
but here is a suggestion...

first, try another php test.
in a php file try this code on line 1. (no other code)

<?php phpinfo(); ?>

save it as test.php
the page should work when going to your test.php page
that will show your php information if its working properly.

if all you see is the text then your php is not working.

if its working edit your php.ini file if needed.
(likely have to use the php.ini editor in cpanel)

if your php code gets commented out automatically its a sign
that your code has errors or was not correctly added to your page.
 
Last edited:
Top