Support » Fixing WordPress » Can’t edit main theme php files after upgrading to 4.9

  • Rizonesoft

    (@petrichorpost)


    I am unable to edit main theme (php) files using the build in WordPress editor after upgrading to version 4.9. I get the following 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 have cleared my browser cache, cleared my website cache, de-activated all plugins and reinstalled main theme.

    Furthermore; I am able to edit php files in other themes without issues. I have also checked my permissions and ownership of all files. Everything seems perfect.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 106 through 120 (of 124 total)
  • Dpsachou

    (@dpsachou)

    FYI

    Another plugin tested that causes the loopback issue is the “WP Server Stats”

    BackuPs

    (@backups)

    @crzyhrse great work, but i still have the issue without any plugin active. it is getting frustrating. still waiting on the host with their findings.

    @dpsachou The loopback problem has been fixed in WP Server Stats v1.5.7. Thanks for reporting it.

    Dpsachou

    (@dpsachou)

    @saumya Majumder

    Well glad that you fixed it, wow this was a quick response.

    WP Server Stats is a great plug in, I would not want to dismiss it because of this issue.

    The thing is, many other plugins are causing the loopback issue. Is there a specific script or command that causes it?

    • This reply was modified 2 years ago by Dpsachou.
    • This reply was modified 2 years ago by Dpsachou.

    While fixing the WP Server Stats plugin, this was my findings regarding this issue: https://wordpress.org/support/topic/plugin-is-blocking-loopback-requests-in-wordpress/#post-9718002

    Dpsachou

    (@dpsachou)

    Hello again,

    Saumya Majumder discovered that the issue is with themes or plugins that use PHP Sessions.

    After the session_start() command, php session hangs causing a timeout. This prevents the loopback request.

    After making some tests on my own, I found out that when the session is closed with a session_write_close() command, the issue disappears, and everything is working fine again. So the real issue does not seem to be on the php session itself, but rather to the open php sessions that never close.

    I guess that the open session locks the session files in php (?) and creating the problem.

    Just wanted to follow up on the Pods side, it’s not related to the new theme editing 4.9 feature itself but a file in a theme that is calling a function it expects to have access to when the plugin is not activated or loaded. Sorry for any confusion there in that discussion.

    Moderator Marius L. J.

    (@clorith)

    Thanks @sc0ttkclark, good to hear it’s not in PODS it self (that would’ve been a fun evening ๐Ÿ™‚ )

    @webstooni I removed your post, as linking off-site to someone providing custom core edited files is not a solution and poses a risk to our users.

    For those still experiencing issues, we’re working on a better way to identify them with the Health Check plugin, it should be ready some time this weekend as we’re doing final tests to it, we’ll update here when it’s in place ๐Ÿ™‚

    timtekk

    (@timtekk)

    Still a major problem for many, many users. WordPress needs a patch fix ASAP.

    Moderator Marius L. J.

    (@clorith)

    Hiya,

    So for those still experiencing problems, we’ve just released a new version of the Health Check plugin, focused around the scenarios we have here.

    When you load the Health Check tab under Dashboard > Health Check, it does a preliminary loopback test, if it fails you are given an option to test again without any plugins active (don’t worry, it’s only for the loopback test, your site visitors won’t notice a thing), if it determines that the failure no longer exists if you run it without plugins, you can perform a 3rd step to test individual plugins to identify which one (or ones) may be interfering with things.

    So if you’re still having problems, give it a go, if you’ve not already ot a version of it available, it can be grabbed from https://wordpress.org/plugins/health-check/ or from within the WordPress add plugins page ๐Ÿ™‚

    BackuPs

    (@backups)

    @clorith… does this plugin auto update? I still see the same version 0.60 in my admin area as i had before. Anyway on the loopback i got this.

    The loopback request returned an unexpected status code, 403, this may affect tools such as WP_Cron, or theme and plugin editors.

    So now the question is: What is causing that on my server?

    I tried these. But they did not work https://www.danhendricks.com/2017/01/wordpress-error-http-loopback-connections-disabled/

    • This reply was modified 2 years ago by BackuPs.
    andreich

    (@andreich)

    @clorith @backups Looks like I have the same issue:
    – I unable to save changes in Theme editor.
    In a minute or two as I click save button I get get message: “Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over http://FTP.”
    And my entire site (admin panel and all pages) doesn’t respond for a couple minutes after this.
    – When I trying to save changes to my posts or pages, I got message:
    “Connection lost. Saving has been disabled until youโ€™re reconnected. Weโ€™re backing up this post in your browser, just in case.”
    And site doesn’t response as in previous case.

    I installed Health Check plugin. It says: “The loopback request to your site took too long to complete, this may prevent WP_Cron from working, along with theme and plugin editors.”

    I have another WP site installed on the same server which is working with no problem.

    Please help!

    Moderator Marius L. J.

    (@clorith)

    @backups Hmm, I did not account for the strange HTTP responses, if you go into the tab labeled Troubleshooting, enable troubleshooter mode and try to do your file edits, do they still not work, if they don’t, I am inclined to think it’s a security feature implemented by your host.

    @andreich These are two different issues, you could also try the Troubleshooter mode mentioned above, but it sounds like an intermitten connectivity issue so can’t say if it’ll work or not.

    BackuPs

    (@backups)

    @clorith troubleshooting mode does not help. I dropped it at tier.net and asked them if they can setup a clean wordpress in on of their servers and test the issue. I got a reply that they have similar results as i have and could not edit a single php file. I am waiting on their next reply on this issue.

    BackuPs

    (@backups)

    @petrichorpost that you can edit not active themes is normal. The code only checks if the php file you are editing is from a active theme. The php files from any theme that is not active can be edited without any issues. From any plugin or theme that is active it is impossible to edit any php file.

Viewing 15 replies - 106 through 120 (of 124 total)
  • The topic ‘Can’t edit main theme php files after upgrading to 4.9’ is closed to new replies.