Search code examples
phpmamplampsublimetext3

T_CONSTANT_ENCAPSED_STRING & sublime


Trying sublime3 (unregistered demo) today and really liking the workflow much better then dreamweaver but keep getting T_CONSTANT_ENCAPSED_STRING errors on my production LAMP server, but not my local MAMP testing server (using Filezilla for SFTP to lamp server)

I deleted everything in both of these test files, retyping(not copy and pasting) into each file only this... (using sublime)

UnitTest.php

<?php 
require_once ('dbentity.class.php');
?>

dbentity.class.php

<?php
echo "hello";
?> 

or im getting the T_CONSTANT_ENCAPSED_STRING error

but if dbentity.class.php is

hello

(no php tags) I do get the result of "hello" being printed into the browser.

This is totally stumping me I've checked the character encoding(UTF-8) and chmod (644) so that doesn't seem to be the problem. I've been developing in dreamweaver for about 2 years and haven't run into this problem, my best guess is that sublime is creating gremlins, but I know lots of PHP developers that use sublime...


Solution

  • One thing you should check besides encoding and chmod is line endings, I never stumbled upon a problem with them, but I know some people who have.

    In Sublime go to View -> Line endings and set them to Unix.

    I have always set them to Unix and never had any problems with any language, with any language interpreter/compiler and OS.