2012-07-16 17:07
浏览 43

未捕获的SyntaxError:意外的令牌ILLEGAL load-scripts.php:1

I'm developing a wordpress plugin locally using:

  • MAMP (updated to PHP 5.4.4)
  • PhpStorm
  • Chrome

I've turned off short tag, magic quotes and zlib compression, but occasionally load-scripts.php comes back all gibberish:

Broken page

The admin area has no styling, and none of the scripts on the page load or work.

Occasionally, though they do work with a few hard refreshes ( shift + cmd + r )

I've seen a few similar examples and tried their fixes, to no avail (hence disabling short tags, magic quotes and zlib compression).

I've tried it in Firefox, and it breaks ... but when I hard-refresh the page a few times, the issue goes away.

I cannot replicate the issue in Safari.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

7条回答 默认 最新

  • douao1854
    douao1854 2012-10-09 15:28

    I had the same issue. Deleting my cookies from that domain and clearing my cache fixed it.

    点赞 评论
  • dsa88885555
    dsa88885555 2012-08-12 19:25

    Please clean your browsers cache and delete all cookies. Also disable any caching on your localhost webserver installation.

    From what you describe, I'd assume this is apache webserver caching and it does this because you once had compression enabled, something PHP might have done transparently before you configured it not to.

    Look into your webservers manual and deactivate any caching. Any. That is important for debugging the issue.

    Also disable anything that might set headers to tell the browser that it's okay to cache something in the browser cache. See your webservers' manual and disable anything such.

    If the webserver had already cached those responses, you can reload how much you want, you will always see that but not in case repetitive reloading de-actives caching for the one or other request.

    点赞 评论
  • dpy33121
    dpy33121 2012-10-17 17:23

    The issue, as hakre points out, is almost certainly the cache setting in MAMP. You need to disable it by going to MAMP > Preferences > PHP and set Cache to '--'. Restart MAMP, clear your browse cache and cookies and reload the page.

    点赞 评论
  • dsgrgaz321973284
    dsgrgaz321973284 2013-06-25 19:06

    Re-uploading the entire wp-includes directory fixed the problem for me.

    点赞 评论
  • dongyuelian9602
    dongyuelian9602 2014-01-02 23:20

    Simply restarted my Mamp web server and it fixed the issue.

    I also emptied my browser cache and deleted cookies but that didn't help.

    点赞 评论
  • douyiyi5284
    douyiyi5284 2015-10-06 17:43

    In my case, the error was showing up when I was trying to save a DOMDocument (file) in a folder that wasn't there. I was trying to do something like this:


    But the folder TEMP wasn't there thus the error was pomping up.

    Saving the file to the current directory (e.g. $xml->save("test.xml"); fixed the issue.

    点赞 评论
  • dplp5928
    dplp5928 2016-11-10 16:56

    While you have those dev tools open, if you click and hold the refresh button, some extra options should appear. None of the other solutions here worked for me, but the Empty Cache and Hard Reload option in that drop-down cleared it up.

    点赞 评论