-1

I have been running a local .php files for weeks, if not months, now and suddenly today it doesn't display the html in the code, just the code.

Is there any idea what I was doing to make that work?

To be fair, there isn't php CODE in the file: changing the extension to .html has it working correctly now.

This is less of a problem and more of a curiousity of how a thing was working versus doesn't work now.

Kamurai
  • 143
  • 2
  • 4
  • 19
  • AGAIN, this is not running PHP code, it's just a .php file. – Kamurai Apr 21 '18 at 01:21
  • You do not .php files if it is just html code. It is better to change your files to .html – Charis Moutafidis Apr 21 '18 at 01:22
  • This is not a duplicate, apologies for poor wording on the original title. – Kamurai Apr 21 '18 at 01:22
  • 1
    Were you accessing them via something like `http://localhost/file.php` or `file:///path/to/file.php`? – ceejayoz Apr 21 '18 at 01:22
  • Which is what I said I did. My point is that it has been working for weeks until today, I'm trying to figure out why. – Kamurai Apr 21 '18 at 01:23
  • @ceejayoz yeah, it was file:///C:/Video/Show.php (I shortened it) – Kamurai Apr 21 '18 at 01:24
  • Not sure why, but again do not mix up file extensions. Yes, it is the same but it is more clear id your file is an .html file. Technically all of them could be .txt files. – Charis Moutafidis Apr 21 '18 at 01:24
  • @CharisMoutafidis So you're claiming if I run a .txt file with html in it, then it will run in chrome as an html page? Even though the .php file doesn't? Testing this – Kamurai Apr 21 '18 at 01:27
  • nnnnope, that doesn't work either – Kamurai Apr 21 '18 at 01:28
  • Sorry, what I ment is that all of them are text files, not .txt files. They contain characters. – Charis Moutafidis Apr 21 '18 at 01:28
  • Yeah, none of this traffic has been helpful, sorry. – Kamurai Apr 21 '18 at 01:30
  • Feel free to use .html extensions from now on to be sure it works fine ^_^ – Charis Moutafidis Apr 21 '18 at 01:34
  • What you're describing is exceedingly odd and I'm not sure any of us have any chance of deciphering what you were doing. I doubt Chrome was executing PHP files internally or something. – ceejayoz Apr 21 '18 at 01:34
  • I was likely something close to what Charis was talking about, the browser was reading the text and saw html and compiled it. This isn't normal behavior, though it's allowable to write straight html in a .php file. As it wasn't an important file, I stopped when it did what I wanted. – Kamurai Apr 21 '18 at 01:37
  • Because it was wrongly labeled as a duplicate I can't answer or put further explanation elsewhere, so here: Apparently there was a chrome update last Tuesday, it might have corrected the sympton I've notice in some of the navigation and url spoofing corrections. And I honestly feel it's immature to down vote a legitimate question because you can't answer it. – Kamurai Apr 21 '18 at 01:46
  • 1
    You are literally using .php files for html, what did you expect people to do? :P – Charis Moutafidis Apr 21 '18 at 01:54

1 Answers1

0

To run php code you need an ide or an apache, xampp for example. Apache needs to be enabled to make php code run. The .php files use echo to diplay the html code in the browser.

Charis Moutafidis
  • 363
  • 1
  • 4
  • 17