Search code examples
phpgulpgulp-connect-php

gulp-connect-php not working


I cannot get gulp-connect-php to work. I tried about everything SO and the www has to offer. The message I get is as following.

PHP server not started. Retrying...

Here's the last code I've tried.

gulp.task('connect', function() {
   connect.server({
      hostname: 'localhost',
      bin: 'C:/php/php.exe',
      ini: 'C:/php/php.ini',
      port: 8000,
      base: ''
   });
});

Now I've tried using it with browser-sync and the express server. With those I can get .html-files working on localhost. But whenever I set a .php-file to load I read a 404 or if I put in the url directly I download the file.

I've tried on Windows 10 and on El Capitan (these particular lines of code adjusted of course for MacOS). I checked that PHP is installed and added to the PATH. Not to mention that I've tried various different setups in my gulpfile.js.

EDIT: I installed XAMPP. PHP works fine there. The very script I try loading with gulp works fine.


Solution

  • What version of gulp-connect-php are you using? I have use this for many projects and it worked great until recently when I updated the module. I deleted the module and installed the last version that worked for me 0.0.5, and it's working as expected. You could try the same and see if it works- delete the folder and use:

    npm install gulp-connect-php@0.0.5