• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PHP previews are a mess - What is going on

Community Expert ,
Sep 12, 2020 Sep 12, 2020

Copy link to clipboard

Copied

A few years ago I did a lot of PHP/MySQL web development for my site. MAMP is set up on my computer, the local database is set up, everything works just fine if I go to http://localhost/mstrg.com/main/ to preview a new template for the site. Here's proof:

Screenshot_2020-09-11 23.17.37_GSWMFo.png

The only thing I have done to this template so far is to load it up in the "main" subdirectory, copy the files, and change the extension to PHP.

 

When I open the page in Dreamweaver, even though the testing server is properly set up, most of the template shows up in the preview (live), it's just missing all of the images and it doesn't scale properly.

Screenshot_2020-09-11 23.11.04_BVDDOH.png

If I choose preview in any browser I get this mess and look at the URL.

Screenshot_2020-09-11 23.13.54_2i84mH.png

Where did http://127.0.0.1:56565/preview/app/index.html come from? The file name is index.php and it's in the main subdirectory. Entering the localhost URL works just fine. Everything comes in as it should. It doesn't matter what file I am previewing the file name always comes up the same. 

 

I did not have any of these problems with previous versions of Dreamweaver. Previews always went to the localhost/directory/filename and everything always worked.

 

Before you start thinking that there is something in the code that fouls things up, all I have to do is change the extension from PHP to HTML and Dreamweaver perfectly displays a preview and it scales and shows the responsive design as expected:

Screenshot_2020-09-11 23.40.37_fL0bPv.png

But the preview is still fouled up completely and the weird file name and path are still fouled up. 

 

Here are my questions: Why did Dreamweaver start generating these weird preview files? How do I get back to a version of Dreamweaver that works because the last version that I used, and had been using for years, was about 6 years ago? If enabling a PHP localhost and browsing to the file you want to preview works perfectly, why is Dreamweaver having so much trouble with the file? I have tried all available current versions of Dreamweaver.

 

One last thing. If I connect this template to a database and just test for the connection and echo "Successfully Connected" Dreamweaver loses all of the rest of the page. I just get a preview that says "Successfully Connected." All of the images and the placeholder text is gone.

 

My only option now is to just browse to the file in my browser by starting with localhost and live with the complete lack of a preview in Dreamweaver. This is a serious problem for me. Any hint at a solution would be appreciated.

TOPICS
Browser , Error , Preview , Server side applications

Views

241

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2020 Sep 12, 2020

Copy link to clipboard

Copied

Real-Time Preview (RTP) is not the same as old fashioned Preview In Browser (PIB).  It uses Adobe's servers and an Iframe to render the page.  RTP doesn't play nice with my local testing server (Wamp) so I have turned off RTP in my Preference settings (Preferences > Real-Time Preview > tick the box for Default to static browser preview.)

 

Alternatively, you can right-click on an open tab and select Open in Browser which does the same thing as PIB from your localhost.

 

As to why images don't display in DW, that might have to do with whether you're using site root-relative or document -relative link paths.   Site root-relative links rarely work locally but they work fine on remote servers. I usually use document-relative link paths.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2020 Sep 12, 2020

Copy link to clipboard

Copied

Both of your screenshots show index.html, not index.php.  If your Bootstrap template contains PHP scripts or SSIs, you should rename it index.php.   NEVERMIND. 

 

I think Mamp uses PHP 7 by default.  Change DW's PHP version in Preferences > PHP.

 

In one screenshot, I'm seeing a red X in a circle denoting code errors. A green checkmark in a circle is preferred.  When validating PHP files (Window > Results > Validation), use the check Live Document option.

 

For best results, the local site folder should reside inside the testing server's default web folder.  In Xampp, Mamp and Mamp Pro, that would be the htdocs folder.

Local Site in Local Testing ServerLocal Site in Local Testing Server

 

Also, did you define the local testing server model under the Advanced tab?

Advanced Tab > Server modelAdvanced Tab > Server model

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2020 Sep 14, 2020

Copy link to clipboard

Copied

I've been through all of that. Also found out that Safari will not work at all using Localhost. Chrome and Firefox will respond when using localhost but if I want to preview anything in Safari I have to use 127.0.0.1 

 

I worked around that problem by changing the web URL for the testing server. Here's the thread on that problem: https://community.adobe.com/t5/dreamweaver/localhost-problems-with-safari/m-p/11432065?page=1#M20551...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2020 Sep 12, 2020

Copy link to clipboard

Copied

I forgot to mention there's a Preference setting for Server-side includes now.

Go to Edit > Preferences > Invisible Elements.

Server-Side Includes:  ☒ Show contents of included file.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 13, 2020 Sep 13, 2020

Copy link to clipboard

Copied

Thanks for your advice. I kind of got it working, then moved to my MacBook Pro and I'm getting localhost previews in Chrome and Firefox but Safari will not connect to localhost. It will connect to http://127.0.0.1

 

I'm seeing a lot of posts on the apple forums from a couple of years ago but I can't figure out how to make Safari work with Localhost. I think I will start another thread.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2020 Sep 14, 2020

Copy link to clipboard

Copied

I never use Safari.  But I suspect the problem is incompatibility with Mamp server, not DW.

https://wordpress.org/support/topic/safari-cant-find-the-server-message/

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2020 Sep 14, 2020

Copy link to clipboard

Copied

LATEST

It's not MAMP, I tried three different servers and Dreamweaver just does not like PHP on a Mac.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines