Add using "localhost" as a testing server to accommodate a working preview

How do I configure PG’s Settings to preview and test my php serverside code without having to first remove the absolute path:

so my localhost could immediately parse and open the page? (Adobe’s Dreamweaver has always had this feature).
Is there a way to set this in this section of the Settings screen?

This would greatly enhance and speed up testing my pages on localhost.

Hi @randyrie,

Unfortunately that’s not possible.
What I use is MAMP Pro a local server that also has a free version that works only with one project:
https://www.mamp.info/en/mamp/windows/
Connect the project folder with MAMP and your ready to go.
I wished there was more PHP implementation in Pinegrow too!
Pinegrow shows PHP pages without PHP includes out of the box!

Regards,

David

@randyrie - I’ll second what @AllMediaLab said. I’m not sure about the Windows or Linux version, but on the Mac the regular MAMP version will let you run as many projects as you want. You can load the PHP containing project in both MAMP and PG. You won’t have dynamic reloading upon save in PG, you will have to manually reload your MAMP browser to see changes. It doesn’t slow the workflow overly much.

1 Like

I realise that you want this in PG. And possibly not in a separate browser.
But won’t this be doable with the “Live Server” add-on for VSCode with Live Server Web Extension ?

Sync PG with VSCode. Edit in VSCode. “File >> Save All” in VSCode to trigger the “Live Server” reload. (Or enable auto-save in Live server, and set the afterDelay property of Live Server.)

Or keep VSCode w/ Live Server running minimised in the background, with the same project opened as in PG. Then save from PG to let VSCode w/ Live Server reload the browser page(s).

This is just hypothetical. I did not try this.

Hi Bob,

No you can only host one URL at the time.

From their website:
With MAMP PRO you can create as many hosts as you want. Each host can be configured individually and thus adapted exactly to the target system. For example, choose if you need an Apache or NginX web server, which PHP version is needed, or if and which caching system is used. This allows you to work on your different projects in parallel without losing sight of the big picture.

Of course when you disconnect one URL and connect a other you can run as may projects as you want!
But that’s not what I tried to explain.
I use Mac and Windows MAMP Pro and both are similar in functionality!

Regards,

David :wink:

Hmm, maybe we are using different terminology. I agree that each “site” you are running concurrently will be on the same base server - either Apache or Nginx, the same PHP version, etc… with the free version, but, you can have multiple WP sites open at the same time.


Basically, everything in my MAMP/htdocs folder is accessible. Most are both a WP install and PG project.
image
If I need to change server type or PHP version I have to shut-down the server and restart. I guess that is what you mean by only hosting one URL at a time?
I’ve also tried to set-up the “Live Server” with “Live Server Extension”, but can’t seem to get it working. Sort of bogged with projects right now or I would fool around with it a little more.
Bob

This is what I try to explain and why I think it’s wise to upgrade to Pro:
David

I think you guys are on about the fact that the PRO version-allows creation of MULTIPLE HOST NAMES

Whereas free allows one i think or not many

I’m going to re-phrase my question…
I’d like a way to configure PG so that when I browse I do not first have to first delete the highlighted text in the URL shown below (the absolute path) so my localhost (I don’t use MAMP) will parse and open a PHP webpage.


The URL above displays the full file path which will not parse and open PHP pages without me first deleting the highlighted text - - so I’d like Pinegrow to open with my localhost’s URL instead of the full file path which will allow the browser to open and run php pages. As I noted above, Adobe’s Dreamweaver has always allowed local testing of php pages via a direct URL to localhost, using its native port.

I hope I’m explaining my issue understandably.

1 Like

have you tried searching for that text within the PG installation folders to see if there is a text file or .json you can just edit?

@droidgoo - - No I haven’t (didn’t even think of doing a search) what keyword or phrase do you suggest I use?

just a shot in the dark… something that would be used to determine that url.

“localhost”
“40000”
“webserver”

@randyrie - If you do a cut and paste on the URL can you delete the region you highlighted and get access to the unsaved changes in on your own local server?
side note - rolling your own server, or using something other than MAMP?

Yes… That’s what I do now (cut out the highlighted part of the URL) but I’m looking for a way to set PG to only use my server’s localhost address without it adding the 4000 port and file:/// path so it opens and runs php without having to first remove the port and file path. I have my Mac setup as its own server running PHP and MySQL - I’m not using MAMP.

When I select to view in browser, the full path displays in the browser’s address box… I have to manually delete the " :4000/file:///Library/WebServer/Documents " (see highlighted text below) to get the browser to open and run the php page:

Is this making sense? See my attached video:


How does everyone else test their php/MySQL pages on their computers?!

On my Mac and Windows computer I use MAMP it’s super easy and saves hours of time. You only have to push a little drop down button to choose your preferable browser. This is what you see in the browser when you use MAMP. All my projects are PHP. I use Sublime text aside Pinegrow and MAMP PRO. You can install WordPress and several others in 1 minute etc. You can transfer a WordPress site from the real server to MAMP and the other way around. It shows you PHP includes and Pinegrow doesn’t. You can test PHP forms with emails from the local server, test and configure your databases and it go’s on and on:

@randyrie your running two seperate web servers with totally different characteristics, like running text edit and MS Word to view the same textfile-and expecting the results to look identical.

Pinegrow runs its own server, you view its output in a browser via port 4000 or whatever - this is the texedit view, it doesnt parse PHP files and do funky PHP stuff.

Your MAC is ALSO running a webserver! This is the Word version, will whatever all singing and dancing capabilities you have installed and whatever version of PHP it is running. This is usually on and defaults too, port 80

They are BOTH viewed via “localhost” url and whatver the rest if thr URI is.

Now, when you view via. Port 4000, you are viewing the PG server’s output of your file in your browser.

WHEN YOU DELETE THE PORT 4000, YOUR BROWSER DEFAULTS TO PORT 80- and you are then viewing the funky, full blown PHP rendered version of your file on your MAC’S WEB SERVER.-you are no longer viewing via the PG internal server.

Its like looking at your kitchen table from the outside of your house through 2 different windows- one sparkly and super thr other, well could do with some fixing up!
Table is your php file/site
2 windows, are web serverz, house is your Mac.

So if you actually have that set up correctly, use it!
You are trying to get PG webserver tondonsomething it cant, instead of just using your exisitng webserver, which can, and either refresh browser when you save or use a browser live reload function plugin, like VSCode editor has-which you use.

So get the plugin, do your php coding in that, open your browser open the php file project and click “live view” at the bottom of the editor.

Job done
No mamp

VSCode also has a “live Server” plugin- this is similar to the PG approach- it is a seperate server again, I am not sure of its capabilities with PHP

Yeah @schpengle, I know and understand everything you’ve said since I’ve been doing this for years, albeit without PineGrow, its CSS package and its inability to interface with a database like Dreamweaver did/does. I’d like the folks at PG offer an option for the user to elect how their PHP/MySql pages can be live tested… but I think this ain’t ever gonna happen by virtue of how PineGrow was built and the dis-interest of its builders. (But it would still be a nice feature for us PHP guys who’ve been using Dreamweaver).

@randyrie
All that you are looking for is implemented in Mamp Pro, but maybe in the future some plugin will come for Pinegrow I have no time to wait and waste and have my doubts that what Mamp Pro is offering will ever be possible in Pinegrow. Mamp is a one time payment of € 69,- for this version, that’s peanuts for what you can do with it and the time you save every day.

@randyrie Just help yourself and get going. There are workarounds.

@AllMediaLab Strange to advice him to buy a product he really don’t need! He already got everything setup and running, he got already his own local webserver, with PHP and MySQL support working.

Randy only wanted to know if it’s possible to let Pinegrow launch the correct “preview url” for him. The one being processed by his own local webserver (with PHP and MySQL support), instead of the Pinegrow internal webserver url.


@randyrie You can maybe use bookmark(s) in your browser, to select and load the homepage for the project you need to view.

Or you can make yourself a simple (don’t need to be fancy or funky, only need to be functional) start/launch index page yourself, with links to your local projects (homepages). And put it in your webserver root directory. Which you then can access when requesting only “localhost” in your browser. From where you can click the project you want to view.


I never use the “preview link” in Pinegrow, always use my browser to select and load the project I want to view/preview.