Can't create site with PHP 7.4.30

I have an issue with creating a site with custom settings.

Here is how I came to a point of creating a new site with custom settings.
I pulled the site as always, however, my local setup is v8.1.23 vs the production setup v7.4.
When I try entering any edit page (pages, posts or ACF field edit group), I got a critical error.
Here’s what I got

PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "contact_meta_boxes_setup" not found or invalid function name in C:\Users\myUsername\Local Sites\mySitename\app\public\wp-includes\class-wp-hook.php:324

Based on my research, this is an incompatibility of some plugin and PHP v8, but I could not find where it was caused. So I decided to go with creating a new site with v 7.4.30 installed (along with 1.16.0 nginx and mysql 8.0.16).

I get the error message twice before the site creation is aborted and I get back to Local “Select a site” screen.

I have Windows 10 Pro.
Local: Version 9.0.3+6684.
I am attaching Local logs.
local-lightning.log (932.8 KB)

I need help either fixing the issue with creating local site with php v7 or maybe if someone knows how to fix that issue with PHP v8 invalid callback.

I will add couple other notes here:

  1. I tested by disabling every single plugin except ACF(that is required to work on the theme). The issue with error I am getting for site with php v8 remains the same.
  2. I have other site created long time ago with php v7.4.30 and that site has no issues working on the front-end and back-end when I try editing the page or a post
  3. I was able to pull the production to another local site with version 7.4.30 and everything worked as expected. So the older local sites work with php v7.4.30 but I can’t create a new one.
    Please, advise on it.

Did you try creating a new PHP 7.4.30 site using the older MySQL 5.x version?

There might be an incompatibility with PHP 7.4.30 and MySQL 8.x.

One of other sites created earlier has PHP 7.4.30 with MySQL 8.0.16

This particular site is working with no issues.

What about if you use MySQL 8 and more recent PHP version does that work?

Do you mean to test creating a site with php 8 and MySQL 8.0.16?

Yes or PHP 8.1/8.2/8.3

I was able to create site with PHP 8.1.23 and MySQL 8.0.106 without the error as I output here. However, the site responds with 404.
I checked Local Router Logs (as that’s what is says in 404 page) and the last error message is from 20 minutes ago and not now when I try accessing the site.
I am attaching local-lightning file for you.
local-lightning.log (101.8 KB)

When you get the 404 error can you open your dev console? Do you see any errors in there? Feel free to send a screenshot.

Hi Nick,

Well, it started today. No 404 error now.

Since there were no errors now and the site has been created successfully, I decided to try creating site with php 7.3 again, and it failed as described in the initial message in this thread

Are you talking about the fatal error? Or a Local popup error? Can you share a screenshot?

Here is what I got again when I tried creating the site:
the error message twice before the site creation is aborted and I get back to Local “Select a site” screen.

Does it matter whether you select NGINX or Apache?

I only tried creating site with nginx as it is what I need

Were you able to test using MySQL 5.7 with these PHP versions to see if that works?

I don’t understand what incompatibility are you talking about if I have older sites with PHP 7.4.30 and MySQL 8.x working with no issues. The issue is that I can’t create new sites with the same settings

It may help us to narrow down the issue if something changed in Local versions from when you created those sites. As a test are you able to just try creating a new site with that configuration and see if it works? I’m asking the Devs to look into this but I don’t have a Windows VM to try and replicate.

Hey @rilel

It’s hard to say what exactly is going on. I tried replicating things within a Windows VM and was able to create a PHP 7.4.30 site with MySQL 8.0

I notice in the Local logs that were provided, that there are a number of errors related to MySQL not being able to start due to a port already listening on the desired port. Those lines look something like this, though note that the port changes whenever a new site is created and it tries to take a free port:

{"class":"Process","level":"warn","message":"2024-05-07T20:05:08.562984Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Only one usage of each socket address (protocol/network address/port) is normally permitted.","process":"mysql","thread":"main","timestamp":"2024-05-07T20:05:08.564Z"}
...
...
{"class":"Process","level":"warn","message":"2024-05-07T20:05:08.562993Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 10182 ?","process":"mysql","thread":"main","timestamp":"2024-05-07T20:05:08.565Z"}
{"class":"Process","level":"warn","message":"2024-05-07T20:05:08.563247Z 0 [ERROR] [MY-010119] [Server] Aborting","process":"mysql","thread":"main","timestamp":"2024-05-07T20:05:09.795Z"}
{"class":"Process","level":"warn","message":"2024-05-07T20:05:09.793666Z 0 [System] [MY-010910] [Server] %%userDataPath%%\\lightning-services\\mysql-8.0.16+6\\bin\\win64\\bin\\mysqld.exe: Shutdown complete (mysqld 8.0.16)  MySQL Community Server - GPL.","process":"mysql","thread":"main","timestamp":"2024-05-07T20:05:09.795Z"}

I’d be curious to know what other thing is listening on that port when the site tries to start.

As a test, can you try creating another site with PHP 7.4 and MySQL8 and if it still fails in the same way, check to see what is already listening on that port.

You can find that port info by:

  1. Opening a cmd.exe session with administrative powers
  2. run the netstat -anob command
  3. Find the port number that is mentioned in the errors and note what application has already taken the port

While this screenshot isn’t showing the error, this is sort of the type of output you can expect as you investigate:

Using that info, you might be able to determine what is already listening on those ports. If so, can you try and stop whatever is blocking mysql from starting and then try creating another site?

Hi there, I tried creating the site again and it failed with the same error. But when I looked into ports as you explained, I don’t see the port 10016 used anywhere.

I also did what Nick suggested above - creating the site with php 7.3.0 with older mysql 5.x (which needed to be installed as I never used it). I get the same error and the site creation is aborted

You probably won’t have the same port as I do. You’ll need to search for whatever port is reported in Local for the site that you create and is having issues.