LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-21-2011, 09:23 PM   #1
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 62
Blog Entries: 1

Rep: Reputation: 15
Question syntax error near unexpected token `newline'


Hi,
I'm new to php. I wrote a basic php script using gedit:

<?php echo "Hello World"; ?>

Saved is as FirstPHP.php
Then I did a chmod 755 FirstPHP.php
and ran it. Got the following out put:


$ ./FirstPHP.php
./FirstPHP.php: line 1: syntax error near unexpected token `newline'
./FirstPHP.php: line 1: `<?php echo "Hello World"; ?>'


Why am I getting a syntax error? Am I missing something?

Thanks,
Ron
 
Old 07-21-2011, 10:33 PM   #2
(=AA=)
LQ Newbie
 
Registered: Dec 2002
Location: UK
Distribution: FreeBSD
Posts: 24

Rep: Reputation: 3
What happens if you type: php FirstPHP.php
 
2 members found this post helpful.
Old 07-22-2011, 12:43 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This is a good intro http://www.ibm.com/developerworks/op...s-php-command/
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error: unexpected token `newline' CarlosV Programming 4 05-17-2011 03:47 AM
Syntax error near unexpected token jchmski Programming 5 06-18-2010 10:28 AM
syntax error near unexpected token `newline' uhollins Linux - Newbie 6 12-04-2008 01:18 PM
syntax error near unexpected token `fi' sureshkumar.repaka Linux - General 7 08-19-2007 10:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration