Can't edit child theme's functions.php

Windows 10 x 64
LocalWP Version 7.2.1+6433
Trying to edit child theme’s functions.php I get an error

Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.

and the file change remains unsaved. Edit the file with a code editor works like expected, editing of other files works too.

Is it a bug or do I something wrong?

Hi @EvgeniyO

Can you provide some more details on this?

What theme are you using?

What is your PHP version?

What is your WordPress version?

I use picostrap5 blank child theme, https://picostrap.com/?pico_start_download&download_id=2,
2023-10-12_175453

Thank you!

Could you share your Local Log with us as well? There are some different ways to access and share Local Logs. For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Sure, here they are.
local-logs.zip (24.3 KB)

It looks like something might be conflicting with Local on your machine.

Are you running other developer applications simultaneously? That could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.

Do you have any antivirus, security, or firewall applications that could be blocking Local? It looks like from the log it might be having trouble connecting.

More details about troubleshooting this here: Router Mode

You could also try changing your Router Mode to Localhost and then see if you can edit: Preferences>Advanced>Router Mode>Localhost

No, I use no any devtools like listed by you. But, if you name what exactly can be blocked by Local (url, port or similar) I can ask our sysadmin, whether our environment were involved into the troublemaking.

If you look at your router log you can see what sorts of requests are erroring out and where. If you’re using a work/office network there might be a firewall or other security in place that’s running some interference so it might be worth checking with your admin or IT for a deeper look!

I think, related is this block:

2023/10/13 20:50:15 [error] 22540#20312: *1 upstream prematurely closed connection while reading response header from upstream, client: ::1, server: examplecom.local, request: "GET /wp-admin/?localwp_auto_login=1 HTTP/1.1", upstream: "http://[::1]:3000/wp-admin/?localwp_auto_login=1", host: "examplecom.local"

2023/10/13 20:50:15 [warn] 22540#20312: *1 upstream server temporarily disabled while reading response header from upstream, client: ::1, server: examplecom.local, request: "GET /wp-admin/?localwp_auto_login=1 HTTP/1.1", upstream: "http://[::1]:3000/wp-admin/?localwp_auto_login=1", host: "examplecom.local"

2023/10/13 20:50:15 [error] 22540#20312: *3 upstream prematurely closed connection while reading response header from upstream, client: ::1, server: examplecom.local, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "http://127.0.0.1:3000/wp-admin/admin-ajax.php", host: "examplecom.local", referrer: "http://examplecom.local/wp-admin/index.php"

2023/10/13 20:50:15 [warn] 22540#20312: *3 upstream server temporarily disabled while reading response header from upstream, client: ::1, server: examplecom.local, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "http://127.0.0.1:3000/wp-admin/admin-ajax.php", host: "examplecom.local", referrer: "http://examplecom.local/wp-admin/index.php"

2023/10/13 20:50:17 [error] 22540#20312: *1 connect() failed (10061: No connection could be made because the target machine actively refused it) while connecting to upstream, client: ::1, server: examplecom.local, request: "GET /wp-admin/?localwp_auto_login=1 HTTP/1.1", upstream: "http://127.0.0.1:3000/wp-admin/?localwp_auto_login=1", host: "examplecom.local"

2023/10/13 20:50:17 [warn] 22540#20312: *1 upstream server temporarily disabled while connecting to upstream, client: ::1, server: examplecom.local, request: "GET /wp-admin/?localwp_auto_login=1 HTTP/1.1", upstream: "http://127.0.0.1:3000/wp-admin/?localwp_auto_login=1", host: "examplecom.local"

2023/10/13 20:50:17 [error] 22540#20312: *6 no live upstreams while connecting to upstream, client: ::1, server: examplecom.local, request: "GET /robots.txt?1697223017681 HTTP/1.1", upstream: "http://localhost/robots.txt?1697223017681", host: "examplecom.local"

2023/10/13 20:50:17 [error] 22540#20312: *7 no live upstreams while connecting to upstream, client: ::1, server: examplecom.local, request: "GET /robots.txt HTTP/1.1", upstream: "http://localhost/robots.txt", host: "examplecom.local"

Did you have any luck checking with your IT team?

If you change your Router Mode to Localhost are you able to proceed? Preferences>Advanced>Router Mode>Localhost

Yes, I’ve got it work on this way. No clue why :slight_smile:

1 Like

You can read more about how Localhost works in our help guide below. Basically something else was blocking or getting in the way of Local on Site Domains mode. Glad you’re able to proceed now!