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.
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
Please provide your Local Log. See this Community Forum post for instructions on how to do so:
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
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: