Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress include SVG file error

I use PHP and WordPress.

On localhost I can include a SVG file without problems, but on the live server. I try to include an SVG file to be able to style it with CSS.

I got this error message

Parse error: syntax error, unexpected T_STRING in
/www/webvol1/34q/h6njx/mysite.com/public_html/wp-content/uploads/2014/02/fish_icon.svg on line 1

I run a file_exists on the file and it returns true but the include does not work. Why not? Why on the localhost and not the live server?

like image 205
Jens Törnell Avatar asked Feb 20 '14 13:02

Jens Törnell


1 Answers

My hosting allowed <? and the include thougt it was a PHP file, not an XML file.

I had to run echo before the XML.

<?php echo '<?xml version="1.0" encoding="utf8"?>'; ?>

It makes WordPress not be able to read this image, it prevents a good image preview. Other clever solutions are still welcome...

like image 129
Jens Törnell Avatar answered Sep 29 '22 02:09

Jens Törnell