由SVG引起的PHP Parse错误

问题描述:

I have this SVG on the server. Everything is fine, until I try to use PHP to include it into my page. When I do that, it causes 503 errors to appear on all pages, not just the one I have the SVG included on. When I use rhc tail to see what's going on, I get this:

[Tue Nov 11 19:47:37 2014] [error] [client <ip>] PHP Parse error:  syntax error, unexpected 'encoding' (T_STRING) in /var/lib/openshift/<undisclosed>/app-root/runtime/repo/images/svg/monitor.svg on line 1

This does not happen on my local (Linux) server.

我有这个 服务器上的SVG 。 一切都很好,直到我尝试使用PHP将其包含在我的页面中。 当我这样做时,它会导致所有页面上出现503错误,而不仅仅是我包含SVG的错误。 当我使用 rhc tail code>查看发生了什么时,我得到了这个: p>

  [Tue Nov 11 19:47:37 2014] [错误]  [client&lt; ip&gt;] PHP解析错误:语法错误,/var/lib/openshift/<undisclosed>/app-root/runtime/repo/images/svg/monitor.svg中的意外'编码'(T_STRING) 第1行
  code>  pre> 
 
 

在我的本地(Linux)服务器上不会发生这种情况。 p> div>

You have PHP short tags enabled, so it's trying to parse it as a PHP file.

You can disable this in a number of ways. php.ini is your best option: http://php.net/manual/en/ini.core.php#ini.short-open-tag