Reputation: 563
I've run into an issue with updating the header.php file in a WordPress website.
Firstly, I tried updating the file manually through C-Panel -> File Manager. The code appears to stay in the file, but when you view the page source in incognito mode and different web browsers the code doesn't render.
It's not a server problem, I already contacted the server support team and there aren't any error logs being reported by MySQL.
There doesn't appear to be many solutions for this from what I can find from doing some searches on Google.
Full 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.
Upvotes: 14
Views: 85341
Reputation: 486
The error could also happen if you have HTTP AUTH password for the site. Make sure that .htacess is present in the home folder of the site.
If not go to Settings -> Permalinks -> Save
Upvotes: 0
Reputation: 314
If you encounter this issue while using Docker with WordPress, a solution is to start Docker with the flag --add-host yourdomain.com:127.0.0.1. Alternatively, you can manually modify the /etc/hosts file with this information to resolve the problem.
Upvotes: 0
Reputation: 181
Mine was a plugin and the problem was because I was editing a plugin that was active. Just deactivate the plugin and try again.
Upvotes: 0
Reputation: 99
Super late to the party, but if this helps someone.. This fixed my issue
Edit line from /wp-admin/includes/file.php
if ( $is_active && 'php' === $extension ) {
to
if ( $is_active && 'php' === $extension && false) {
Upvotes: 2
Reputation: 874
If you are using Cloudflare, try Cloudflare's "Development mode" button. (This is what cured it for me). Other answers have mentioned issues with Cloudflare but development mode is easy to check if it cures the problem, easy to implement whenever you want to edit, and safe because it disables itself if you forget to turn it off.
Upvotes: 2
Reputation: 2417
I agree with @nickdevyyc that, there is no technical solution for this. But It's better that we can use some external plugin which provide File Manager and where we can edit every file. Here one I found
https://wordpress.org/plugins/theme-editor/
This work with me like a charm and save my day!
Upvotes: 4
Reputation: 2236
In my case, I used a wordpress installation behind cloudflare. My website protocole was HTTPS as I used the cloudflare certificate. However, on the server side, it was a self-signed certificate.
I have installed a let's encrypt certificate in place of the self-signed certificate and then it worked. Afterwards, I could save PHP files in the wordpress file editor.
After installing a wordpress plugin named health check, I saw that the error was "curl self signed certficate".
Upvotes: 7
Reputation: 81
Cloudflare was my issue as well. I had a firewall rule limiting access to wp-admin and that was preventing me from saving file edits. I had to add a firewall rule to allow my particular IP address.
Upvotes: 4
Reputation: 995
I'm a little late to the party, and Mtxz is right on their answer. However, their solution doesn't "fix" the issue. I found this forum which says you can solve it by removing lines 492 - 599 in the wp-admin/includes/file.php file.
The first line is if ( $is_active && 'php' === $extension ) {
and the third last line is return new WP_Error( 'php_error', $message, $result );
, followed by two lines of brackets.
This fixed the issue on several of my servers.
Note: this solution also removes PHP debugging, so if you have a syntax error and you do this, your site might crash and you can't edit the files unless you go through SFTP/FTP. As always, it's best to have a backup before editing files.
Upvotes: 3
Reputation: 21
I had a similar issue, my wordpress version is 5.2.2.
"Database Browser" plugin, which is untested with my version of WordPress created the issue. It was fixed by deactivating that plugin.
So check the plugins which are "Untested with your version of WordPress" ( this can be seen while installing a plugin from dashboard-> plugins-> Add new ), deactivate them (if unnecessary ) and try using "theme editor" for updating file.
Upvotes: 1
Reputation: 3697
What worked for me is disable all plugins and then re-enable them. This was caused by a wordpress update. Everything is working as expected now, but it was quite frustrating..
PS: Use the bulk deactivate action.
Upvotes: 11
Reputation: 563
Now, this technically didn't fix the issue at hand. But I just added a WordPress plugin called Insert Headers and Footers and I added the header script and it worked successfully.
Upvotes: 2
Reputation: 3879
This error comes from a Wordpress feature included in Wordpress 4.9. It basicaly check for PHP errors upon file uploading in the WP file editor to prevent saving code that could/will break your site.
It's mostly a plugin (or a server configuration) that prevent the Wordpress loopback check to properly check for potential errors caused by your update. As Wordpress is not able to check whether your new code will produce errors or not, it prevents the code update.
Check those links:
You could try disabling your plugins to see if the feature make it back, or update your files using FTP/SFTP (without the Wordpress file editor).
Upvotes: 7