Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Gulp Basics Improving your Gulp Task Pipelines The Build and Development Pipeline

Kayla Johnson
Kayla Johnson
1,798 Points

http-server for PHP server

Through this tutorial we've worked with just an index.html file. I'm trying to repeat the process with a simple client site that uses PHP. It only gives the file structure when ran as explained in the videos.

I tried reading up on setting up a connection with gulp-connect and gulp-connect-php packages. and neither work. It just sits there trying to connect even though the terminal says a server has been started.

I tried using gulp-websever as well and all I get is a EADDRNOTAVAIL error which means nothing to me or google.

Using PHP is essential to my client work and the tutorials never went in depth to explain how to set up a functional and practical web server. Because, let's be honest, no one devs in .html files.

4 Answers

Seth Kroger
Seth Kroger
56,413 Points

http-server is a simple, bare-bones server only meant to serve static files. In order to run PHP, you need a server that supports it like Apache or Ngnix. (and make sure the PHP support is installed and configured)

Seth Kroger
Seth Kroger
56,413 Points

Apparently, gulp-connect-php will start up PHP's built-in server. This means you need PHP installed separately for it to work (standalone or packaged in XAMPP/MAMP/etc.). This server is for development only, not to be deployed.

Craig Fender
Craig Fender
7,605 Points

I think you're looking for something like MAMP or XAMPP that you can install on your PC/Mac and run as a local server for testing your code on. Just do a Google search for either of those. I believe Treehouse has an instructional video of how to setup a local development server for PHP if you look in the PHP library of videos.

Kayla Johnson
Kayla Johnson
1,798 Points

I've used xampp before. But in the research I did for using something like gulp-webserver or gulp-connect it doesn't mention requiring something like that. It sounds like they should work in replace of that.

Craig Fender
Craig Fender
7,605 Points

I'm not really sure what Gulp is. I've never played around with it. But from what little I saw about it online and based on what Seth said above, it isn't going to run PHP code for you. You'll need a server for it that can run the PHP code on the backend; hence, the need for MAMP or XAMPP. Otherwise, I don't really know. Sorry.

jason chan
jason chan
31,009 Points

Gulp is usually for javascript. Not php stack.

You can use prepos if your trying to do sass compilation.