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 trialDom Smith
3,091 PointsUsing PHP in Adobe Brackets Code Editor?
Hello Guys,
I'm current developing using Adobe Brackets, and plan to create a user login using PHP and a MySql database. However I'm struggling to find a way to get php working with Brackets as it doesn't automatically recognize the .php file format.
the error i'm getting is "To launch live preview with a server-side file, you need to specify a Base URL for this project"
Has anyone else stumbled upon this problem, and if so how did you solve it?
Thanks in advance
7 Answers
thomascawthorn
22,986 PointsHave you avoided using something like MAMP on purpose? It's always best to test in a real browser!
Dom Smith
3,091 PointsNo I haven't it looks like it would have saved me a lot of time. I'll have to check it out at some point and see if its what I need.
Waldo Alvarado
16,322 PointsIn Brackets go to File ---> Open Folder... (Ctrl + Alt + O) open up the folder containing your php files (i.e. index.php), then open up your index.php, click live preview and type in http://localhost/. This should work for you.
Antonio Jaramillo
15,604 PointsAlso keep in mind that you really don't need to use the Live Preview feature in Brackets if you are using a local server. I currently have my project in the htdocs folder of my Apache installation. By merely starting up Apache, typing in my localhost URL and clicking refresh whenever I make changes, Brackets still works like a charm.
bkjpkfikxu
2,303 PointsBrackets with PHP works for me. You might have to go to the lower-right, and click on "HTML" (or whatever other language it says), and change it to PHP:
Dom Smith
3,091 PointsCheers for the response, I've already got that set to php, in the Live preview I got the error
"To launch live preview with a server-side file, you need to specify a Base URL for this project"
you haven't come across this before?
bkjpkfikxu
2,303 PointsOh. Yes, I've had that. Sorry, but I don't know how to fix it :(
bkjpkfikxu
2,303 PointsOne thing: I used to use Brackets, but just a couple days ago started using C9. I haven't done any PHP with it yet, but they probably have a live preview for it (that works ;), and I'd recommend them if you ever feel like moving your code editing to the cloud.
Wesley Guirra
Courses Plus Student 153 PointsYou need to install a server in your OS like wamp, XAMPP, or other of your preference, after install, just start apache, and check if the server is started typing localhost in your browser, after started you need to put your project in the server folder (it'll change depending of server that you've installed), then when the Brackets ask you the url just type the location of your project like "http://localhost/yourproject" without quotes.
it's all.
sorry for my english.
Diego Hernandez
11,468 PointsHi! I had the same trouble and this worked perfectly.
You can install MAMP (a program for running PHP as a local host). This video explains the installation process: For Mac: https://teamtreehouse.com/library/setup-your-local-development-environment-2 For Windows: https://teamtreehouse.com/library/setup-your-local-development-environment
Once you do all that is told in the video go to brackets-> live preview -> and place the base url like this: http://localhost:8888/foldername
foldername is the name of the folder where your css, html and php files are.
That simple!
Lacey Brown
5,340 PointsAnother recommendation is using the application CodeKit. You just enter in your server info, and your browser refreshes upon each save. I love Brackets, but I prefer Live Experimental Preview vs. manually refreshing the browser after each save.
Dom Smith
3,091 PointsDom Smith
3,091 PointsDidn't find a solution, so a answer would still be grateful I just ended up using the WebMatrix software which comes with PHP MySql packages included. Far from ideal but a get around at least.