Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not reloading in php #8

Open
victorpetuluku opened this issue Dec 14, 2017 · 5 comments
Open

Not reloading in php #8

victorpetuluku opened this issue Dec 14, 2017 · 5 comments

Comments

@victorpetuluku
Copy link

Hello, (first sorry about my english)

Im having a error with your wonderfull extension, when in use it on a php proyect the browser stop reloading, if the php file don't have any php call (plain html only) the extension works, but when i add a php call (for example, echo 'hi';) then stop working.

Im using a xampp server with the proxy mode in browser in local.

Regards!

@Jasonlhy
Copy link
Owner

Do you embed the php call inside HTML body?

@timmornYE
Copy link

Same here with a docker apache: webdevops/php-apache on Windows. But I also get no refresh with plain html if there is no html backbone. I think there are many cases where you need it to work without a complete html backbone.

Reproduce

File index.html with content

Hello World!
  1. Open file with "Browser sync: Proxy mode at side panel"
  2. Enter IP and Port of Webserver (files resides in document root)
  3. File opens in side Panel but does not reload on change and save
  4. "Browser sync: Refresh side panel" works as expected

When index.html looks like

<!DOCTYPE html>
<html lang="de">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Titel</title>
  </head>
  <body>      
    Hello World!
  </body>
</html>

all works as expected.

@StructByLightning
Copy link

Thanks timmornYE, that fixed it for me.

@Holmes-EH
Copy link

Holmes-EH commented Apr 11, 2020

Thank you @timmornYE ! It also fixed it for me.
I am running apache2/PHP 7.3 on osx and could not get auto refresh.

Once I added the HTML backbone, the extension works as expected.
In fact only the beginning of <!DOCTYPE html> up until the opening <body> tag is necessary.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

For PHP development, my workaround is to include a header on every page rendered by apache.

To finish, thank you @Jasonlhy for this great extension !!

edit : I am using "Browser sync: Proxy mode in browser" with open folder

@JamesLauffer
Copy link

JamesLauffer commented May 29, 2021

Thank you @timmornYE. Your answer in this older thread just solved the problem for me. I did some further testing. It looks like the only necessary tags iare the HTML and body tags.

<HTML>
<body>
<?php
echo "Hello World"
?>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants