0

I have a project that is using node and php. I have been using gulp-connect-php npm package to serve up the php server.

Now I am trying to clone this project over to my laptop from my desktop. I have shrinkwrapped the dependencies and the project is tested to run fine on 2 desktops as soon as I run npm install and gulp after cloning. The problem is that the project doesn't seem to work on my laptop. When I try to run gulp on my laptop, it ran all its gulp tasks except it is not starting the PHP server like so:

PHP 7.0.0 Development Server started at ...
Listening on http://127.0.0.1:8010

What I have in my gulp task:

var browserSync = require('browser-sync');
var gulp        = require('gulp');
var php         = require('gulp-connect-php');

gulp.task('serve', function() {
    php.server({
        base: 'build',
        port: 8010,
        keepalive: true
    }, function() {
        browserSync({
            proxy: '127.0.0.1:8010/build',
            watchTask: true,
            port: 8000
        });
    });
});

What can else can I do to find out why is the PHP server not being started?

Jenning Ho
  • 1
  • 1
  • 3
  • What operating system is this running on? – Jake Jul 07 '16 at 18:10
  • @Jake It is running on Windows 10 (on all PCs tested) – Jenning Ho Jul 07 '16 at 18:26
  • 1
    I have manage to solve it. Just in case anyone is facing the same problem, it is because php is not installed properly during the installation of xampp. Once I add php path to the environment variables, everything runs fine. Apparently gulp-connect-php runs the installed php to start up the php server. Refer to http://stackoverflow.com/questions/17727436/how-to-properly-set-php-environment-variable-to-run-commands-in-git-bash on how to add path to environment variables. – Jenning Ho Jul 11 '16 at 03:23

1 Answers1

0

You PHP server is already running in build directory.So give proxy value as proxy:127.0.0.1:8010. You can browse you site through localhost:8000.