Better support for non-WordPress PHP CMS without requiring explicit MySQL ports

Hello,

Local already works well as a local PHP environment for non-WordPress projects, and your documentation mentions that users can create a WordPress site, remove WordPress files/database tables, and then use the environment for another CMS.

I would like to suggest improving this workflow for non-WordPress PHP applications such as Winter, MODX, custom PHP CMSs, etc.

At the moment, Local creates an individual MySQL instance for each site and assigns it a dynamic TCP port, for example:

localhost:10005

WordPress can usually use simply:

localhost

because PHP is configured with the correct Unix socket:

mysqli.default_socket = /Users/.../Local/run/.../mysql/mysqld.sock

However, some third-party CMSs explicitly read mysqli.default_port. In Local, this value may be empty or tied to the generated TCP port, so such applications may require the port to be written manually in their configuration:

mysqli://user:password@localhost:10005/database

This creates two inconveniences:

  1. The Local MySQL TCP port can potentially change.
  2. Non-WordPress projects become dependent on a Local-specific port, even though the Unix socket already exists and works correctly.

It would be very useful if Local had an option such as:

“PHP compatibility mode for non-WordPress applications”

or

“Use Unix socket for localhost connections”

This option could ensure that PHP applications using localhost can reliably connect without specifying Local’s dynamic MySQL port.

Possible implementation ideas:

  • provide a valid mysqli.default_port together with the existing mysqli.default_socket;
  • make the generated PHP configuration more compatible with applications that expect mysqli.default_port to contain an integer;
  • expose a dedicated non-WordPress environment preset;
  • optionally generate a generic PHP/MySQL configuration file containing database credentials, socket and connection information;
  • add a “Non-WordPress site” option when creating a new Local site, so WordPress does not need to be installed and deleted first.

Ideally, a third-party CMS could simply use:

host = localhost

without needing to know the Local TCP port.

This would make Local much more convenient as a general-purpose PHP development environment while keeping the current WordPress workflow unchanged.

Thank you!

Thank you for creating this detailed feature request @dimuchio! While we are primarily WordPress focused, we’re always monitoring our Community for interest in new or different features and settings.