Browser-sync: BrowserSync + gulp + wamp not syncing .php files

Created on 15 Jan 2016  路  1Comment  路  Source: BrowserSync/browser-sync

HI
my gulp file:

var gulp        = require('gulp');
var browserSync = require('browser-sync').create();

//server
gulp.task('run', function() {
    browserSync.init({
        proxy: "http://localhost/test-site/"
    });
    gulp.watch("./*.php").on('change', browserSync.reload);
});

when running gulp run from terminal it's fire the browser and shows the page as expected but without the "connected to browserSync" msg and when saving some changes the gulp watch fires and the terminal shows [BS] Reloading Browsers... but the browser not refreshing the page

now on the other hand when i'm changing the file extension to "html" and gulp watch to gulp.watch("./*.html").on('change', browserSync.reload);
it all work as expected: when running the task it's fire the browser, this time with the "connected to browserSync" msg and when saving some changes it refresh the page.
early today i did manage to refresh the page on php file change but i lost it and can't find the reason why it's not working any more, i couldn't find any post about it on google
any ideas ?

Most helpful comment

first, check the site being served by your php files meets the requirements https://www.browsersync.io/docs/#requirements

After that (make sure you have a <body> tag etc), you can remove the gulp watcher and instead use the files option in browsersync

//server
gulp.task('run', function() {
    browserSync.init({
        proxy: "http://localhost/test-site/",
        files: ["**/*.php"]
    });
});

>All comments

first, check the site being served by your php files meets the requirements https://www.browsersync.io/docs/#requirements

After that (make sure you have a <body> tag etc), you can remove the gulp watcher and instead use the files option in browsersync

//server
gulp.task('run', function() {
    browserSync.init({
        proxy: "http://localhost/test-site/",
        files: ["**/*.php"]
    });
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

hgl picture hgl  路  3Comments

adjavaherian picture adjavaherian  路  4Comments

demisx picture demisx  路  4Comments

w88975 picture w88975  路  3Comments

sedubois picture sedubois  路  3Comments