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

Bug Summary

Summarize the issue in one to two sentences.

When adding custom code to the functions.php file via Appearance > Theme File Editor, I receive 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.”.

I can edit the functions.php file directory via the file system and add the code but I am trying to demonstrate this during a course. I have tried changing themes, tried deactivating plugins but the error still occurs. Using Twenty Sixteen theme and have a child theme created of it. It is a demo website used for teaching WP.

I originally report this issue back in May 2021 but it is still happening over 2 years later.

Steps to reproduce

As precisely as you can, list the steps it takes to reliably reproduce the issue.

Environment Info

Describe your environment.

  • What Operating System are you using? Windows 10
  • What versions of site software (Nginx, Apache, PHP, MySQL) is used? NGINX, PHP8.1.9 and MySQL 8.0.16.
  • What version of Local is installed? 7.0.2+6395

Supporting info

Please provide your Local Log. See this Community Forum post for instructions on how to do so:

Include any screenshots or video recordings of the issue to help others reproduce.

Hi @thetraininglady!

Thank you for circling back to us. I got caught up on your issue from your previous post here:

So it sounds like the issue is a bit intermittent. Did it resolve itself between your post in 2021 and now for any period of time? Or has it been ongoing?

When you and the students are all practicing this are you all offline? Or are you connected to a school or office network at all? Any VPNs involved?

Do you use any other developer applications in your teaching? Apps like MAMP, XAMPP, or Docker for example.

Is everyone using the same OS/version?

Keep us posted and we’d be happy to help further!

Certainly not intermittent as it has been an ongoing issue since my post back in 2021. Just thought I would reopen this to see if can find a solution.

When running the course it is all online so we all have full internet access. Personally I am not connected via a school or office network and majority of participants are usually on their home computer or sometimes on their work computers, no VPN’s in use. ALL participants except it seems Mac users seem to have the issue. I just had a Mac user in a session last week who was able to save through the Theme File Editor.

We do not use any other developer apps during the training although I have WAMP installed my computer. Seems to happen in both Windows 10 and 11 but as I said some Mac users don’t have the issue.

Everyone is importing a pre-made website via Local import function so all using the same set up.

If only Windows users are experiencing the issue it could be that some native security, antivirus or firewall feature is blocking Local. You could check here first:

Trying to run other developer programs side by side like WAMP could also cause issues. Another thing you might try is changing your Router Mode from Site Domains to LocalHost. Preferences>Advanced>Router Mode

Everyone has different computer systems on different networks. I’ve had issues even with NO antivirus on my computer.

I am not running WAMP and Local at the same time, they are both installed but i only use 1 at a time. All my students only have Local installed - no WAMP.

I cannot add code via the Theme File Editor for ANY website I have set up in Local.

I just tried changing the router mode over the localhost. Reloaded the website and tried to add code again. Still get error.

I’ve also just tried turning off the Windows Security.
Reloaded LocalWp. Started up website. Tried to add code via Theme File Editor.
Still no luck, same error.

Hi @thetraininglady

I found a StackOverflow thread here regarding the same error. A lot of users were reporting it was caused by a plugin conflict. Have you tried disabling plugins to see if that allows you to proceed?

As a workaround, have you tried editing the files manually using a text editor versus the native Theme Editor?

I’ve already tried deactivating plugins, i’ve tried switching to a default WP theme, didn’t help.

Yes i can edit the files manually with a text editor, it works and that’s how I’ve been doing it for the past few years. But obviously would like to know why it won’t work through LocalWP and then be able to explain to students attending the course why it’s not working.

Hi @thetraininglady - I tried digging into this some more today and ended up spinning. I guess it is a classic “good news, bad news situation”.

Bad news - I can’t pin down exactly what the error is. It seems to be something about the combination of the 2016 theme and version of PHP being used. It don’t think it is a network issue, as I can reproduce it too.

Good news - I can see it working on my Windows machine when I upgrade to the 2022 theme and use it there. Do you see the same? If you create a new site on Local, using PHP 8.1 or PHP 8.2 (both worked for me), and use the 2022 theme, and then try to make changes in the Theme Editor, do you see them save successfully?

Edit: Here’s my Windows environment showing success, even going back to the 2021 theme: