• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting out; strange issues (single-line comments)

#1
[eluser]pointfive[/eluser]
I've installed CI and it went smoothly, however as I'm going through the tutorial, I'm getting strange errors. Long story short, single-line quotes (both // and #) will cause the script to throw a syntax error:

Quote:Parse error: syntax error, unexpected $end in /home/mysitename/ci/application/controllers/pages.php on line 1

i.e., from the Static Pages tutorial, this bombs out:

Code:
$data['title'] = ucfirst($page); // Capitalize the first letter

...while this does not:

Code:
$data['title'] = ucfirst($page); /* Capitalize the first letter */

I've written plenty of from-scratch PHP and never encountered this problem. In fact, I have scripts with single-line comments running on my host as we speak.

The only thing I can think of as possibly being an issue: I don't have CI running out of /public_html (as you may have noticed above). I installed /system and /application under /home/mysitename/ci (for security reasons as suggested in the installation instructions). I set the path variables in index.php accordingly (actually, I'm referring to it as index_ci.php). Could this configuration be causing some funkiness?

My host is running PHP 5.3.17, so I doubt it's a version issue. I'm getting other weird issues, but I'll leave it at this for now. Any light anyone can shed would be greatly appreciated; I'm excited to get started with CI but right now I feel like I'm tripping on my shoelaces as soon as the starter pistol goes off!

#2
[eluser]TWP Marketing[/eluser]
Are you by chance using short php tags on your document:
Code:
<?=
or
<?

#3
[eluser]pointfive[/eluser]
Nope... I'm using:

Code:
<?php
...
?>

#4
[eluser]PhilTem[/eluser]
Do you have the Directory-directive configured properly? Otherwise I could only imagine some faulty php.ini configuration (even though I never experienced that problem).

Or you have some strange white spaces in your file?

#5
[eluser]keevitaja[/eluser]
[quote author="pointfive" date="1349123946"]Nope... I'm using:

Code:
<?php
...
?>
[/quote]

never close the php document. just leave it "open"

#6
[eluser]pointfive[/eluser]
[quote author="PhilTem" date="1349124270"]Or you have some strange white spaces in your file?[/quote]
This looks like it was the problem. It seems I was working with a copy of a file which uses "line feed" instead of "carriage return". It doesn't like single-line comments with line feed for some reason. Weird.

Anyway, thanks for the help!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.