title: Create a server that runs PHP with Gulp and Livereload
body: <p>I'd like to adapt this code to serve PHP files. I have MAMP running a local server but I can't figure out how this code works in order to make the necessary changes. I know that Node server won't interpret PHP files, but I'm confused about this architecture using <code>serve-static</code> and <code>serve-index</code> because apparently I can't just use a local file path inside MAMP's localhost to serve those files, right? I also wonder why it needs 2 ports (9000 and 35729).</p>
  
  <pre><code>gulp.task('connect', ['styles'], function () {
    var serveStatic = require('serve-static');
    var serveIndex = require('serve-index');
    var app = require('connect')()
      .use(require('connect-livereload')({port: 35729}))
      .use(serveStatic('.tmp'))
      .use(serveStatic('app'))
      .use('/bower_components', serveStatic('bower_components'))
      .use(serveIndex('app'));
  
    require('http').createServer(app)
      .listen(9000)
      .on('listening', function () {
        console.log('Started connect web server on http://localhost:9000');
      });
  });
  
  
  gulp.task('serve', ['connect', 'watch'], function () {
    require('opn')('http://localhost:9000');
  });
  
  gulp.task('watch', ['connect'], function () {
    $.livereload.listen();
  
    // watch for changes
    gulp.watch([
      'app/*.php',
      '.tmp/styles/**/*.css',
      'app/scripts/**/*.js',
      'app/images/**/*'
    ]).on('change', $.livereload.changed);
  
    gulp.watch('app/styles/**/*.scss', ['styles']);
    gulp.watch('bower.json', ['wiredep']);
  });
  </code></pre>
  
  <p>I basically want to use PHP for templating (footer, header, etc) for a website, just like <a href="https://stackoverflow.com/questions/26226881/gulp-plugin-for-running-a-php-server">this person posted here</a>.</p>
  
  <p>I have the feeling that people don't do this anymore though, so any suggestions for front-end development with static assets and templates (for later adapting to WordPress or another PHP-based CMS) are welcome.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Please read this: <a href="https://stackoverflow.com/questions/27990781/gulp-webapp-running-browsersync-and-php">Gulp-webapp running BrowserSync and PHP</a></p>