为什么我在添加更多代码后立即使用 PHPStorm 获得 "Internal Server Error" 并在 Localhost 上获得 XAMPP?

Why do I get "Internal Server Error" with PHPStorm and XAMPP on Localhost as soon as I add more code?

我在 Win7 上使用 PHPStorm 和 XAMPP。两者都工作正常,但在某些时候,一旦我添加更多代码,我就开始收到“500 Internal Server Error PhpStorm 9.0.2”,例如一个新的 <div></div>。当我再次删除它时,它再次起作用。相同的代码适用于虚拟主机,但不适用于本地主机。

可能是什么问题?

这毫无意义,为什么添加新的 div 会导致服务器错误? error.logphp_error_log 中没有关于此问题的日志。 发现有一个 IDE-错误日志,它说:

2015-11-08 17:49:28,975 [6667034] ERROR - ains.io.fastCgi.FastCgiService - readerIndex(5) + length(1) exceeds writerIndex(5): CompositeByteBuf(ridx: 5, widx: 5, cap: 8189, components=2) java.lang.IndexOutOfBoundsException: readerIndex(5) + length(1) exceeds writerIndex(5): CompositeByteBuf(ridx: 5, widx: 5, cap: 8189, components=2) at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1138) at io.netty.buffer.AbstractByteBuf.readByte(AbstractByteBuf.java:542) at org.jetbrains.io.fastCgi.FastCgiService.a(FastCgiService.java:197) at org.jetbrains.io.fastCgi.FastCgiService.responseReceived(FastCgiService.java:170) at org.jetbrains.io.fastCgi.FastCgiDecoder.contentReceived(FastCgiDecoder.java:128) at org.jetbrains.io.fastCgi.FastCgiDecoder.contentReceived(FastCgiDecoder.java:15) at org.jetbrains.io.Decoder.readContent(Decoder.java:68) at org.jetbrains.io.fastCgi.FastCgiDecoder.messageReceived(FastCgiDecoder.java:75) at org.jetbrains.io.Decoder.channelRead(Decoder.java:38) at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:84) at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:153) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:187) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:947) at io.netty.channel.oio.AbstractOioByteChannel.doRead(AbstractOioByteChannel.java:147) at io.netty.channel.oio.AbstractOioChannel.run(AbstractOioChannel.java:44) at io.netty.channel.ThreadPerChannelEventLoop.run(ThreadPerChannelEventLoop.java:52) at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:834) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) at org.jetbrains.ide.PooledThreadExecutor.run(PooledThreadExecutor.java:56) 2015-11-08 17:49:28,975 [6667034] ERROR - ains.io.fastCgi.FastCgiService - PhpStorm 9.0.2 Build #PS-141.2462 2015-11-08 17:49:28,975 [6667034] ERROR - ains.io.fastCgi.FastCgiService - JDK: 1.8.0_51 2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - VM: Java HotSpot(TM) Server VM 2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - Vendor: Oracle Corporation 2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - OS: Windows 7 2015-11-08 17:49:28,976 [6667035] ERROR - ains.io.fastCgi.FastCgiService - Last Action: ShowLog

您正在使用 PhpStorm 自己的简单内置网络服务器。由于某种原因,它显示了这些错误。如果您有 XAMPP .. 那么只需 XAMPP.

为此,您需要创建一个部署条目,您将在其中指定您的基础 URL,PhpStorm 将使用它在浏览器中打开文件。为此:

  1. Settings | Build, Execution, Deployment | Deployment
  2. 创建并配置新的部署条目("In Place" 应该没问题)
  3. 不要忘记将其标记为该项目的默认设置

现在 IDE 将使用那里指定的 URL 而不是内置的网络服务器。


至于实际错误:

  1. 请尝试最新和最近发布的 PhpStorm v10
  2. 尝试更改您的 PHP 版本(如果您最近升级过)
  3. 如果您希望继续使用内置 Web 服务器供开发人员研究,请向 JetBrains Issue Tracker 提交错误报告。