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 Building Websites with PHP Dependency Management Introducing Composer

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

Building Websites with PHP course: Local wamp workspace setup

I've installed composer on my local server and created the composer.json file as per the lesson. Using command prompt, it saved to 'user/name' on my hard drive along with all the other files created so far. I've moved all the files to my local server in a new folder for this php project in wamp/www/newproject. Now I can't see my local work in my browser using localhost because I don't know how to properly reference the location inside my php file (I think thats what I need to do??) I just downloaded Twig (further in the lesson) and all the Composer files have recreated in the 'user/name' folder

6 Answers

Open the command prompt and change the directory of the command prompt to your project folder. Then type in the composer init command when the command line is in your project root directory.

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

I've got command prompt saving to the right folder which is great, any idea how to view the project in my browser? http://www.localhost.newproject/ & http://www.localhost.com/newproject doesn't work (server not found). I've tried all the folder directory combinations, actual filepath is: C:\wamp\www\newproject This path: http://localhost/www/newproject gives a different error message: Forbidden You don't have permission to access /www/newproject on this server. Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80

It belongs in the root of your project. However, I don't recall actually creating one. When you include something like slim I believe it creates one for you.

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

I've rephrased my question to make it more clear

I don't use WAMP, so I don't know if the www folder is correct, but if it is, then you probably need to enter http://localhost.newproject

The WAMP docs will tell you the root folder. In XAMPP it is htdocs.

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

yes I need to change the location it saves to but don't know how... I think maybe I need to edit the location using a command such as composer config, but that didn't work

What system are you using?

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

Forbidden

You don't have permission to access /newproject on this server. Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80

I did not have these problems when I was using XAMPP on windows 7. I now use Linux so I had to create the permissions to access files for XAMPP. Are you running as Admin? If not, you may try that.

Ilonka Hofmann
Ilonka Hofmann
4,916 Points

thanks Ted, I've installed XAMPP now and it's working:)