live-server

Auto reload issue with the live server?

Do you think your live-server extension in VS code is not working fine?

please note that live-server is just a tool that reloads the script but is not able to compile and run your php script.

So do follow these steps:

  1. Run your script on a regular URL like: http://127.0.0.1/php-daily/181223.php
  2. In vs code start the live server by command: live-server, it gives you a URL with a port number like: http://127.0.0.1:45465/ and you can see PHP script there. Don’t try to run that PHP script.
  3. You have to now change settings in the Chrome browser extension. FIRST change the live server address with the port number URL THEN ONLY enable the live reload option.
  4. Now go to your regular URL http://127.0.0.1/php-daily/181223.php and refresh the page. Start editing the code and this URL will be auto-refreshed. That’s it.

Please note if you set regular URL in chrome extension as 127.0.0.1 and if you try to see auto reload with ‘localhost’ URL it will not work. Use either IP at both place or ‘localhost’ at both place.

Don’t run your script with live-server URL with port number. That is just a URL define so that you can set into extension setting. Get it? This video helps you if you don’t get it.