0

i have a problem with my PHP Code. I wrote something simple:

<?php
echo("Hello World");
?>

Now using xampp locally it works. But when I upload (with Filezilla) and run it on my webserver (Apache, PHP 5.3.24) I get following error message:

Fatal error: Call to undefined function phpecho() in /home/www/earthlost/index.php on line 1

I already figured out, that when I save the file with Notepad++, and open it in Notepad, I get following content:

<?phpecho("Hello World");?>

So obviously, Notepad++ saves some linebreaks, that neither Notepad, nor my online Apache detects as such.

I already made sure, that my Notepad++ saves in "UTF-8 with BOM", but it doesn't solve the problem. So, what should I do?

manlio
  • 18,345
  • 14
  • 76
  • 126
thnew
  • 316
  • 1
  • 3
  • 8
  • Try saving as ASCII instead of UTF. –  Nov 26 '13 at 19:02
  • See http://stackoverflow.com/questions/6986804/validation-error-byte-order-mark-found-in-utf-8-file – aust Nov 26 '13 at 19:04
  • 1
    If you open `View -> Show Symbol -> Show End of Line` in Notepad++ what characters are you seeing at the end of lines? – Grambot Nov 26 '13 at 19:05
  • @aust Solution there says "use Convert to UTF-8 without BOM", I already did this – thnew Nov 26 '13 at 19:34
  • Your issue is that the editor is stripping out the "\n" from the Windows "\r\n" line break sequence. – aust Nov 26 '13 at 19:41
  • @aust do you you know what I can do? I tried several encodings, but Notepad++ always inserts this 'CR' – thnew Nov 26 '13 at 19:55

1 Answers1

1

In Notepad++ go to the menu Edit > EOL Conversion and select UNIX/OSX Format.

For some reason your file seems to be opened as a Macintosh file (with CR carriage returns).

After the change, you will see in the right side of your status bar the correct type of newline: enter image description here

psxls
  • 6,807
  • 6
  • 30
  • 50