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 PHP Basics PHP on the Web Combining Multiple Files with Includes

Alvin Hue
Alvin Hue
4,496 Points

I find it hard to test run php file on my laptop, may I know how can I quickly test run my php code on my laptop?

I find it hard to test run php file on my laptop, may I know how can I quickly test run my php code on my laptop without having to use teamtreehouse workspaces? I can test run my html file but when I run php it's saying it needs some kind of local server or what which is pretty confusing.

You need to have apache server to run php code locally on your machine

Download xammp server https://www.apachefriends.org/download.html and paste the project files in htdocs directory inside of xammp directory.

If you have any port issue while starting apache checkout this link http://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port

2 Answers

Jordan Hausman
Jordan Hausman
5,275 Points

I would install WAMP or MAMP for windows or mac respectively. They are the same as xammp I personally find them more user friendly though. They allow you to host a web server from your pc allowing php files to be executed.

Oleg Kuperman
Oleg Kuperman
2,188 Points

You can follow the link which will provide you a step by step instructional on installing mamp on windows: https://youtu.be/ahaQAB9Hkm8

This video will also explain where is the document root so that you can start testing all your PHP