Live Preview On BBedit

2,318 views
Skip to first unread message

Madelyn Bingham

unread,
Nov 27, 2017, 11:48:00 AM11/27/17
to BBEdit Talk
I have searched various instructional videos on how to use BBEdit, but I haven't found much. I haven't been able to figure out how to "Live Preview" anything. It shows that you can do it, but I can't figure out how. Could someone tell/show me how? 

Bucky Junior

unread,
Nov 27, 2017, 12:36:30 PM11/27/17
to bbe...@googlegroups.com
BBEdit’s Live Preview will render HTML documents with various options. Mostly from memory:

With an HTML type file open, from the menu, select Markup -> Preview in BBEdit. Or, with the HTML tools palette >Window -> Palettes -> HTML Tools Palette, select Preview in BBEdit.

In the Preview window, you can also select pre-defined templates or CSS files to wrap around the content of the HTML file.

The BBEdit Manual is a wonderful document included with the program found in the Help menu. Search for “Previewing Pages.” I found it in Chapter 11, page 238 in my version 11.6.8 of BBEdit.

That said, Live Preview renders HTML elements in my experience. It won’t process PHP and I don’t know about other languages. There are more experienced users who can speak about other languages. In order to process programming, a file needs to be saved and run through a browser like Safari.

Best.

On Nov 27, 2017, at 9:46 AM, Madelyn Bingham <madelyn...@gmail.com> wrote:

I have searched various instructional videos on how to use BBEdit, but I haven't found much. I haven't been able to figure out how to "Live Preview" anything. It shows that you can do it, but I can't figure out how. Could someone tell/show me how? 

--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"sup...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To post to this group, send email to bbe...@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.

Madelyn Bingham

unread,
Nov 27, 2017, 10:12:06 PM11/27/17
to BBEdit Talk
Thank you! That worked!

Greg Raven

unread,
Nov 28, 2017, 7:58:14 AM11/28/17
to BBEdit Talk
BBEdit doesn't preview PHP directly, but it's pretty easy to set up Apache on macOS to serve PHP pages, and then use that from within BBEdit to preview pages.

Omar KN

unread,
Feb 12, 2023, 3:31:50 PM2/12/23
to BBEdit Talk
Now (in 2023) when Apple's server app is no longer supported and Mamp only offers the somewhat spicy-priced Mamp-Pro version, which other server apps are there to preview a couple of PHP pages, most are in html.

/

with best regards, Omar KN, Stockholm, Sweden

2023-02-12

Roger Moffat

unread,
Feb 12, 2023, 4:38:36 PM2/12/23
to bbe...@googlegroups.com
PHP has a basic web server built in to it - I’ve never used it, but if you Google for PHP builtin in web server you’ll find some links and explanations

Roger
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/666d15c3-0d4d-4efa-b0b7-f5fbd307190en%40googlegroups.com.

Bruce Van Allen

unread,
Feb 12, 2023, 4:54:17 PM2/12/23
to bbe...@googlegroups.com
To be clear, macOS still comes ready to serve static and dynamic web pages/apps using Apache. The Mac Server app, now discontinued, isn’t needed.

The last few macOS system updates have removed PHP, but it’s easy to install using Homebrew.

Many on this list could give you the basic simple instructions for setting up web/http service on your machine - it might already be running (try http://127.0.0.1 <http://127.0.0.1/>).

Let us know if that appeals to you.

> On Feb 12, 2023, at 12:31 PM, Omar KN <omn...@gmail.com> wrote:
>
> Now (in 2023) when Apple's server app is no longer supported


— Bruce

_bruce__van_allen__santa_cruz_ca_





Omar KN

unread,
Feb 16, 2023, 4:26:17 PM2/16/23
to BBEdit Talk
My OS is too old I'm told. ( macOS: 10.14.6 )
May have to wait until upgrade…

The http://127.0.0.1 could not be reached.

/

with best regards, Omar KN, Stockholm, Sweden


Roger Moffat

unread,
Feb 16, 2023, 6:23:51 PM2/16/23
to bbe...@googlegroups.com
Open the Terminal and type

sudo apachectl restart

Enter password when prompted.

See if there are any error messages.

Try 127.0.0.1 again browser - or simply http://localhost/

Roger

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

Bruce Van Allen

unread,
Feb 16, 2023, 9:44:22 PM2/16/23
to bbe...@googlegroups.com
Or go Roger one step further:

In Terminal,

# first:
sudo apachectl restart

# then test with:
sudo apachectl -t

If no errors, then in web browser:

<http://127.0.0.1 <http://127.0.0.1/>>

or

<http://localhost <http://localhost/>>


This really has nothing to do with which version of Mac OS/macOS you’re running.


— Bruce

_bruce__van_allen__santa_cruz_ca_
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/A6372BB1-52FF-4E57-99FE-720255F0F624%40gmail.com.

Omar KN

unread,
Feb 17, 2023, 3:00:38 AM2/17/23
to bbe...@googlegroups.com
This did work!  (It works!)

First it was not a global server, but not a problem:

sudo apachectl -t

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using i5-1791.local. Set the 'ServerName' directive globally to suppress this message
Syntax OK

If I don’t need to “set the ’ServerName’ directive globally” (how?) then that’s ok.

Now php pages can be previewed, thanks a lot!

/
with best regards, Omar KN, Stockholm, Sweden
You received this message because you are subscribed to a topic in the Google Groups "BBEdit Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bbedit/H1BoZXcrGDQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/45729C30-9F85-4D61-ABF7-46610A1EF1D7%40cruzio.com.

Bruce Van Allen

unread,
Feb 17, 2023, 11:55:31 PM2/17/23
to bbe...@googlegroups.com
> If I don’t need to “set the ’ServerName’ directive globally” (how?) then that’s ok.

Setting the ServerName directive is one of those Simple/Not Simple junctures for modern computer users.

If at any point these steps go further than you want, you can just accept that in the background that warning will be logged about not being able to determine the server’s domain name.

The Apache webserver has a set of configuration files where all kinds of http server features can be added, enabled, disabled, blocked, accepted, and so on. Cool, but many opportunities for screwing it up. So the byword is don’t mess with things you don’t understand.

The main configuration file is named httpd.conf, and the macOS UNIX-based installation puts it and the other config files in a folder named:
/private/etc/apache2

Unless you’ve modified your Finder, you won’t see this listed anywhere, so use the Finder’s Go command (press command-option-G) and type or paste in "/private/etc/apache2” (no quotes), and hit Return. That folder will open.

You can open and edit httpd.conf with BBEdit. You will need admin permissions to save changes.

Search on “ServerName”.

The ServerName directive is probably commented out (# on the left margin).

For your situation, I think the best idea is:

ServerName 127.0.0.1

You can also include the standard http port:

ServerName 127.0.0.1:80

After saving httpd.conf (really, only change the ServerName directive), go back to your Terminal, and type:

sudo apachectl restart

and then type:

sudo apachectl -t

If all is well, the latter will reply “OK”.

— Bruce

_bruce__van_allen__santa_cruz_ca_
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/E907F633-E996-4A57-9B81-A11324099F1C%40gmail.com.

Omar KN

unread,
Feb 20, 2023, 3:26:13 AM2/20/23
to BBEdit Talk
It did work once now not any more.

What I do:

Starting the server with:

sudo apachectl restart

sudo apachectl -t

http://localhost

I get: It works, then

Preview BBEdit page, only the page code is visible.

The path looks like this: 

file:///Users/okn/SitesMacHD/chu/e/olmc_e.php

if I reload localhost: "It works."

What happened?

/

with best regards, Omar KN, Stockholm, Sweden


Roger Moffat

unread,
Feb 21, 2023, 9:30:29 AM2/21/23
to bbe...@googlegroups.com
You can load a PHP file by opening the file with the file:// protocol

You need to put the file into the WebServer root of the computer in Library/WebServer/ and then open it by

http://localhost/chu/e/olmc_e.php

or something like that - it has to be opened using http to get the PHP code processed.

Roger
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/adddddca-8bef-4f58-8869-a5c02742743bn%40googlegroups.com.

Omar KN

unread,
Feb 23, 2023, 4:34:35 PM2/23/23
to BBEdit Talk
Hi Bruce,

I did all that,

in httpd.conf I set: ServerName 127.0.0.1:80 (uncommented)

With sudo apachectl -t

Syntax OK


and also 127.0.0.1 = It works!

But when I want the Preview for a php file; I still get only the coded page.

/

with best regards, Omar KN, Stockholm, Sweden


Omar KN

unread,
Feb 23, 2023, 4:38:12 PM2/23/23
to BBEdit Talk
In the Library, I only have WebKit, no Webserver there ( Mac OS 10.14.6)

/

with best regards, Omar KN, Stockholm, Sweden


Omar KN

unread,
Mar 10, 2024, 1:01:33 PM3/10/24
to BBEdit Talk

installed and “Successfully started `php@8.1` (label: homebrew.mxcl.php@8.1)”


What is the next step - to view a php page from BBEdit in Safari?

Reply all
Reply to author
Forward
0 new messages