Welcome to the Treehouse Community
Looking to learn something new?
Dom Smith3,091 Points
Using PHP in Adobe Brackets Code Editor?
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
Have you avoided using something like MAMP on purpose? It's always best to test in a real browser!
Also 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.
Brackets 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 Smith3,091 Points
Cheers 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?
Diego Hernandez11,468 Points
Hi! 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.
Lacey Brown5,340 Points
Another 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.