Why is PHP not interpreted in FF, but interpreted in Chrome on my website?

Look at this URL in Chrome and Firefox.

http://gymshuffle.com/contact.html

If FF, the page has uninterpreted PHP code. In Chrome, no.

What will cause the display of PHP in Firefox?

+6
cross-browser firefox google-chrome php
source share
5 answers

Interestingly, it looks like Chrome understands what's in between>? php and? <is not a browser tag and is instead expressed HTML code and never allows it to get a displayed HTML tree. You can see a much simpler version of the same here.

Source

<?php echo ('test'); ?> test 

URL:

 http://alanstorm.com/testbed/chrome-php.html 

If you are viewing the source with Chrome, PHP code is not displayed. If you do this with Firefox, it is.

It is important to remember that your PHP code is not executing. Chrome loads the page with the raw PHP code in it, sees the raw PHP code and deletes it before the page displays.

Update . In 2015, you saw an increase in this indicator, and now it looks like .

+8
source share

Your http server is not configured to send .html files via php interpreter. Try renaming the file from index.html to index.php . Most likely, this will work, but really, please contact your server administrator for help in this configuration problem.

Hi

STB

+6
source share

Firefox considers everything from <php to /> in the first tag to be one big HTML tag. Chrome just ignores everything in PHP tags. To make PHP work, you must change the file extension to .php

PHP is a server language, so none of the processing is done by the browser.

+1
source share

It is interesting. If you look at the source of html, you can see the PHP code in FF, but not in Chrome. Perhaps a MIME problem? You can also try changing the file extension to .php.

0
source share

PHP is server-side. The browser has nothing to do with its interpretation.

0
source share

All Articles