HTML no funciona con PHP

Intenté probando inclusive cada versión disponible de php para que anduviese el código dentro del código o archivo html, también el tan aconsejado código para .htaccess, tres lineas distintas y ninguna anda nunca, con ninguna versión. <? echo 'Ni siquiera lo escribe en un archivo sin extensión, ni tampoco abreviado'; ?> <?php echo "O sin abreviar..." ?>
No se qué hacer, me es muy importante para poder hacer el inicio de sesión y demás datos persistentes con
$_SESSION[‘something’]; Pero no puedo leerlos porque no me andan ni siquiera los print o echo.
Si uso la extensión .html, puedo notar un error de compatibilidad que incluso con o sin no funciona, tampoco con la versión 4.0 php.

En ningún caso me deja usarlo, en archivos sin extensiones no figuran los errores, pero se nota que no escribe nada, a menos que borre el “<?php ?>”

In php files, make sure to use what is used below. :wink: That gives a basic example of the PHP that you should use. :slight_smile:

<?php echo "Testing 123"; ?>

The php works in .php
https://elder-dead-caster-death.000webhostapp.com/Datos/Perfil.php?usr=NahuelBK01

But.

https://elder-dead-caster-death.000webhostapp.com/Paginas/Test1
Its empty

Those 2 files are not in php format. The first file has a .html extension so that’s why it’s not working. You need to rename that to .php. :slight_smile:

But, I need the php inside of html for my index.html
Because I have javascript and css.
I will try other thing? :thinking:

Simple rename index.html to index.php and you’re page will work exactly the same, except that the code will work. Trust me. :slight_smile:

Ohh, thanks, exist something to hide the .php extension from url? Like just now I have… :roll_eyes:

yeah, for sure! Just add the code below into .htaccess. :wink:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php

I can’t, I don’t know how to do… Sorry, can you give me more details plz? You saved me previously :disappointed_relieved:

I just checked your file manager and it already looks like you have the code in .htaccess. You should be able to access pages without .php. :wink:

I see the extension, https://elder-dead-caster-death.000webhostapp.com/Paginas/Indice.php
It’s so strange :thinking:
And if I click the index button, still write Indice.php

What do you see here?

https://elder-dead-caster-death.000webhostapp.com/Paginas/Indice

Ohh… I understand :joy::joy::joy::joy::rofl: Sorry, my bad.
https://elder-dead-caster-death.000webhostapp.com/Paginas/Indice if delete the .php extension from url, works! I’g a dork, lol.
You are genius, thanks you fondly. Lot a hugs from Argentina! I love you haha.
Cold case :+1::+1::+1::muscle:

1 Like

haha, glad I could help out. :smile:

1 Like