问题
I can't use Live Preview on Brackets for my php file. Yes, it's set to php at the bottom right but it still doesn't run. All I get is an error message: "to launch live preview wit a server side file, you need to specify a base URL"
I am running my localhost:8888 with MAMP but even when I enter that into the baseURL it still doesn't preview?
EDIT: I've figured out the problem - I forgot to put my php file into the htdocs folder in MAMP. Now, the problem is that it simply doesn't OPEN when I click my php file from localhost...any ideas?
回答1:
I am having a similar problem, not sure if my solution will help yours as I think this is a work around.
I am running Wampserver to create my localhost and using the lastest version of PHP, and agree with you that you need to put the files in the root directory of the localhost or a subdirectory.
Now one issue had to resolve, not sure if you did this too - was to point to my php.exe in the brackets.json file like so:
"php": {
"enablePhpTooling": true,
"executablePath": "C:\\wamp64\\bin\\php\\php7.2.18\\php.exe",
"memoryLimit": "4095M",
"validateOnType": "false"
},
I also tried running the live preview with project settings first with:
http://localhost/php (where I keep my php files)
and then tried using a Virtual host pointing to the same directory:
myPHP.com
Neither worked from Brackets, though I could use the Wampserver interface to drill into either the directory or VirtualServer which gave me the ability to edit the files in Brackets and just use the browser to test, not ideal but at least I can learn how my code is working or not.
I then switched of "Live Preview" and then ticked "Enabled Experimental Live Preview" from the File menu and found I could launch my PHP files I had opened as a project in Brackets from the root server directory (actually subdirectory in root). Essentially being able to click the lighting button to see the actual web page.
回答2:
i had the same issue, after watching dozens of videos on Youtube which did not work, the solution was quite simple, in order to sync PHP files in Bracket you have to activate filezilla in Xamp, and tick live preview and experimental live preview in Brackets, live preview should work just fine.
回答3:
Go to File -> Project Settings. put ur localhost project link in there for example 'http://localhost/yourprojectname/' in your case 'http://localhost:8888/yourprojectname/' and done.
来源:https://stackoverflow.com/questions/53907435/how-to-run-php-file-in-live-preview-on-adobe-brackets