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 Build a Simple PHP Application Getting Started with PHP Installing PHP

Stephen Mariano Cabrera
Stephen Mariano Cabrera
5,932 Points

Getting LAMP working on linux

I have a question about using LAMP on linux. I'm running Ubuntu 13.04 and I used a tutorial I found here.

After installing PHP, it describes how I could create a test php file and view it in a browser using the following terminal commands:

sudo nano /var/www/test.php

And then editing the appropriate php file in nano to print some example text. I was successfully able to view this in the browser. So far so good.

The only problem with this has been that since then in order to view my PHP files in the browser I've had to write them in another folder and then move them using

cd home/stephen/treehouse/css
sudo cp * /var/www/treehouse  
cd home/stephen/treehouse/img
sudo cp * /var/www/treehouse  

...for every folder

Because apparently I need root permissions to do stuff in that folder. This has been really cumbersome when I've been working on an entire folder and had to move everything to the /var/www/treehouse folder. There has to be a better way right?

4 Answers

Hi Stephen,

If I understand your problem correctly it is that you don't want to have to sudo all day long in /var/www/. If that's the case then just change the permissions of /var/www. sudo chmod o+w /var/www

Jeff

Stephen Mariano Cabrera
Stephen Mariano Cabrera
5,932 Points

I didn't know how to do that, I'm pretty new at working with the console. That should solve my problem and would be a good command to memorize too. Thanks Jeff!

By the way Stephen, "folder" is blasphemy. You are now working with directories.

James Barnett
James Barnett
39,199 Points

Stephen Mariano Cabrera -

> I didn't know how to do that, I'm pretty new at working with the console.

Check out the console foundations course here on Treehouse

Stephen Mariano Cabrera
Stephen Mariano Cabrera
5,932 Points

Thanks! I just started on it and it's been really helpful. Some of the stuff I wish I'd known a while ago!

Hey Stephen,

If you are still interested in being able to keep your local websites in your home directory, as apposed to say /var/www, here is some information that may interest you. LAMP, Linux Apache MySQL PHP

Jeff