Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

Behind the scenes

Why only one copy of Server by Zaweba runs at a time

Server by Zaweba runs one copy per data folder. Launch it again, from Base by Zaweba for example, and the request goes to the copy already running.

Why only one copy of Server by Zaweba runs at a time

Only one copy of Server by Zaweba runs per data folder. If you launch it a second time, whether from the Start menu, a shortcut or Base by Zaweba's Open in Server command, the new launch doesn't start another server. It passes its request to the copy that is already running and steps aside.

It is a small piece of plumbing, but it prevents a whole class of problems that local servers are prone to.

Why two copies would be trouble

A local server owns things that can only have one owner at a time: the web port, the database port, the database files and the configuration it generates. Two copies pointing at the same data folder would both try to start Apache on the same port, both try to open the same MariaDB data, and both try to write the same configuration. At best, the second would fail with a confusing error. At worst, two database processes could reach for the same files.

Tying the single copy to the data folder is the safe rule. The data folder is where the configuration, databases, logs and certificates live, so one owner per folder means one owner for all of them.

Requests passed along

The part you notice is the hand-off. When a second launch carries a request, the running copy takes it. The clearest example is Base by Zaweba. When you export a database from Base as a PHP website and choose Open in Server, Base launches Server with the import request. If Server is already open, perhaps hidden in the tray with your sites running, the request goes to that copy, which then shows the import dialog with a suggested site name.

From there the usual import runs. Server starts MariaDB if it isn't running, makes a database and user, imports schema.sql then data.sql, fills in the connection settings in lan_data.php and adds a PHP 8.2 site that serves the export folder in place. Because only one copy is involved, all of that happens against the same services you already have.

What it means day to day

You can click Server's shortcut without worrying whether it is already open. If it is in the tray, the shortcut brings the request to it rather than creating a duplicate tray icon with a stopped server behind it. You can also use Open in Server from Base as often as you like.

If you ever run Server by Zaweba from two different folders, for instance a second copy kept for a separate set of projects, each folder has its own data, so each gets its own single copy. They would still both want the standard ports, so give one of them different ports in Settings, Ports; the port check will name the other copy if you forget.

The portable connection

This rule fits the way the app is packaged. Server runs from one folder with its components, data and www folders beside the program, and the folder can be moved. Keying the single copy on the data folder, rather than on something installed in Windows, keeps that portability intact. Wherever the folder goes, there is one server for it, and any request reaches that one.