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

PHP Setup Your Local Development Environment

Manual installation of PHP and Apache

Hi,

thanks for the video, it is nice but It could be better to teach us how to set local environment manually. Step by step and explain everything in depth. I managed to screw my Yosemite few days back with using Terminal to install PHP/Apache...

3 Answers

Alena Holligan
STAFF
Alena Holligan
Treehouse Teacher

First off, if you already have a dev environment or prefer one way over the other, by all means use that. This workshop is meant to provide beginners with a simple means to run their PHP sites directly on their machines.

Having said that, if you're on a Mac, setting up a local dev environment directly on your machine is fairly strait forward as Tom Cawthorn pointed out, PHP and Apache are there out of the box, so you just may want to upgrade those. Then that just leaves a database like MySQL which isn't too tough to install. There are some easy to follow tutorials online if you just do a google search. This CAN BE a good option for the speed, as it CAN have the smallest impact on your computer. Windows on the other hand.... I just wont go there :)

However, here are some things to consider:

  1. If you don't actually shut down apache and mysql, you're actually bogging down your computer ALL THE TIME instead of when you want to test out your site.
  2. It's not as easy for beginners and you'll have quite a bit of command line work to do.
  3. If you mess something up, it's not easy to revert, like antonija muscet discovered the hard way. With MAMP, you just delete the folder (or uninstall MAMP Pro) and you're done. The support is what really makes this hard for us to justify at Treehouse.
  4. If you want want to be able to test in different versions of PHP, this can get complicated, buggy and easily messed up. This is actually one of the main reasons I choose to show MAMP is because of the easy way MAMP Pro will let you test multiple versions of PHP. This can be extremely helpful when testing out an upgrade or new server, or testing things like WordPress plugins on multiple versions.
  5. If you're going to work for a large company they will probably have some sort of virtual image for you to use that matches their production environment. This is probably done using something like docker or vagrant, again like Tom Cawthorn suggested. We will probably cover this at some point either as a workshop, blog post or both.

I hope this helps to clarify things a little bit for you. Here at Treehouse we work hard to give you the best experience we can, so thank you for your feedback and stay tuned for more :) For now, like I said before, feel free to use whatever system works for you, just PLEASE TEST YOUR CODE BEFORE YOU DEPLOY TO PRODUCTION :)

Antonija,

Depending on the OS of your computer, it can be a nightmare to manually set up Apache and PHP properly on your computer. Trust me, I had to do it on a Windows environment as a senior project in college and it took me a few tries to do so. It requires a lot of steps, some of which most would give up on and just install either WAMP, MAMP, or XXAMP. If you really want to learn how to install Apache and PHP on your computer, look here. Take your time and read all steps before trying it. Trust me, it will take a while. However, once you know how to do it, it gets easier every time and you've become a benefit for any one or any organization that wants to install PHP without using third-party installations.

Overall, installing Apache and PHP manually is out of the general scope of Team Treehouse and could be considered expert level development. Remember, you are asking to have Treehouse explain a complicated technique in a beginners course which they will not do. However, if enough people ask for it, I don't see why they wouldn't create a workshop explaining how to do it. Of course you would need to ask first. Hope this all helps you and explains things more.

Cheers!

If you are interested in setting up a custom local environment, I wouldn't do so on your operating system.

I would instead set up a virtual machine (a computer within your computer). It's great because if you mess up, you can just kill the machine and start it up again! This way you can better match your live server environment, and also create different 'boxes' with unique environments. It's more advanced, but if you're looking to follow up, take a look at vagrant and virtual box.

The Laravel course guides you through setting up a box - but be aware there's always new versions of everything coming out, so some of the steps are likely to be different.

Also, it sounds like you're using a mac - both php and apache are installed out of the box, were you trying to set up something specific or just get started?