Preview php when webserver is running

Issues related to previewing and publishing your web site.
Post Reply
acroboy
 
 
Posts: 4
Joined: Sat Mar 28, 2020 8:34 am

Preview php when webserver is running

Post by acroboy »

I have read this statement: "You cannot preview pages with PHP in your browser. They can only be viewed on a webserver with PHP installed."

However I have a webserver running and can preview pages with localhost with the correct browser url.

My computer is:
running php server
localhost directory is c:\websites

Wysiwyg settings:
Page property file extension php
Preview folder http://localhost/flowers

Publish to: My Computer
URL: http://localhost/flowers
Host: C:\Websites\flowers
Folder: C:\Websites\flowers

The page used is index.php

Publishing the index.php page is done correctly to the Host directory as index.php

Preview displays url in browser -> localhost/flowers/index.html This url does not have the correct .php extension on the page.
Manually changing the extension in the browser url to .php displays the index.php page correctly.

Is it possible to have the page extension correctly displayed in the preview browser, to accurately reflect the page extension?
If the preview sent the correct page extension .php it would be solved.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Preview php when webserver is running

Post by WWBman »

Using wwb preview will change index.php to index.html as you have seen.
This is because WWB Preview doesn't know about the localhost and uses a 'temp' folder.
You should preview it by using the url localhost/flowers directly from the browser (i.e. not the wwb preview option).
User avatar
Pablo
 
Posts: 23608
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Preview php when webserver is running

Post by Pablo »

Go to Tools -> Options -> Publish
and uncheck 'Remove PHP code during preview'.
acroboy
 
 
Posts: 4
Joined: Sat Mar 28, 2020 8:34 am

Re: Preview php when webserver is running

Post by acroboy »

Thanks Pablo.

Unchecked that option as you instructed.

This solves the problem, and the extension is now displayed in the browser url correctly as .php
and page now displays correctly.

Regards,
Acroboy
Post Reply