Re: [PHP] Intro to PHP question
You sure you don't have something like: ?php html . . . Or, perhaps, if you are usin CGI, and you have JUST set it up, and you have the wrong command line flags to execute the input as PHP directly somehow... Does ?php phpinfo();? work? On Thu, March 8, 2007 11:43 am, Jonathan Kahan wrote: Hi all, I am using a linux server. When the php file below (uri.php) is run from the command line I get the following error. Any ideas on what I could do differently? Thanks for any help, Jonathan ../uri.php: line 1: syntax error near unexpected token `newline' ../uri.php: line 1: `html' html body?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ?/body /html Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
You have managed to confuse the isntallation process and the way Perl works with the way PHP works. If you want to write a custom CGI script for each and every PHP, and prepend #!/usr/local/bin/php, you just MIGHT be able to do it the way you're doing it... But don't do that. :-) Configure Apache to use PHP, and don't make uri.php executable and don't run it from the command line, and use something like: php -q uri.php when you want to run it from the command line. On Thu, March 8, 2007 12:52 pm, Jonathan Kahan wrote: Hi all, Dave, I am attempting to use html for learning purposes. My goal is to begin working on a website. Tijnema, I tried the below and got the following errors. I can't imagine the error on line 3 is a tag issue. Jonathan [EMAIL PROTECTED] cgi-bin]# ./uri.php ./uri.php: line 2: ?php: No such file or directory ./uri.php: line 3: syntax error near unexpected token `D' ./uri.php: line 3: `$d=date(D);' [EMAIL PROTECTED] cgi-bin]# vi uri.php [EMAIL PROTECTED] cgi-bin]# vi uri.php ?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ? - Original Message - From: Dave Goodchild To: Tijnema ! Cc: Jonathan Kahan ; php-general@lists.php.net Sent: Thursday, March 08, 2007 12:43 PM Subject: Re: [PHP] Intro to PHP question If you are running that from the command line, why do you need html? Not sure why you're doing that. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
On 3/8/07, Ben Ramsey [EMAIL PROTECTED] wrote: On 3/8/07 1:44 PM, Tijnema ! wrote: He wanted to use it for the web, so why should he try it out on CL first? Because there are some advantages to being able to run something quickly through the CLI without having to load it in a web browser. He was just doing a simple test, so the PHP CLI was perfect for the job. I can offer a few MBs for everyone that wants to get learning PHP. megabytes? Yeah, a few megabytes is enough to test your PHP scripts out. -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Intro to PHP question
Hi all, I am using a linux server. When the php file below (uri.php) is run from the command line I get the following error. Any ideas on what I could do differently? Thanks for any help, Jonathan ../uri.php: line 1: syntax error near unexpected token `newline' ../uri.php: line 1: `html' html body?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ?/body /html Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Your probably created it from a windows machine. Try converting the file first with dos2unix dos2unix ../uri.php Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Hi all, I am using a linux server. When the php file below (uri.php) is run from the command line I get the following error. Any ideas on what I could do differently? Thanks for any help, Jonathan ../uri.php: line 1: syntax error near unexpected token `newline' ../uri.php: line 1: `html' html body?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ?/body /html Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Unfortunately not. I used the vi editor within Linux to create the file. I am using a windows machine locally but the server I am doing this all in is a Linux server which I am accessing through putty. - Original Message - From: Tijnema ! To: Jonathan Kahan Cc: php-general@lists.php.net Sent: Thursday, March 08, 2007 12:03 PM Subject: Re: [PHP] Intro to PHP question Your probably created it from a windows machine. Try converting the file first with dos2unix dos2unix ../uri.php Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Hi all, I am using a linux server. When the php file below (uri.php) is run from the command line I get the following error. Any ideas on what I could do differently? Thanks for any help, Jonathan ../uri.php: line 1: syntax error near unexpected token `newline' ../uri.php: line 1: `html' html body?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ?/body /html Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
I never work with PHP from the commandline,. but i think it is not possible to use HTML in a php file, so try replacing this: html body?php with ?php echo htmlbody; and replace this: ?/body /html with this: echo /body/html; ? I think that will fix it. Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Unfortunately not. I used the vi editor within Linux to create the file. I am using a windows machine locally but the server I am doing this all in is a Linux server which I am accessing through putty. - Original Message - *From:* Tijnema ! [EMAIL PROTECTED] *To:* Jonathan Kahan [EMAIL PROTECTED] *Cc:* php-general@lists.php.net *Sent:* Thursday, March 08, 2007 12:03 PM *Subject:* Re: [PHP] Intro to PHP question Your probably created it from a windows machine. Try converting the file first with dos2unix dos2unix ../uri.php Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Hi all, I am using a linux server. When the php file below (uri.php) is run from the command line I get the following error. Any ideas on what I could do differently? Thanks for any help, Jonathan ../uri.php: line 1: syntax error near unexpected token `newline' ../uri.php: line 1: `html' html body?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ?/body /html Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Of course it's possible to output raw html in a php file, that's one of it's fundamental uses! In fact, it's more efficient to switch the php parser off and send raw html as the php parser doesn't need to get involved.
Re: [PHP] Intro to PHP question
If you are running that from the command line, why do you need html? Not sure why you're doing that.
Re: [PHP] Intro to PHP question
Hi all, Dave, I am attempting to use html for learning purposes. My goal is to begin working on a website. Tijnema, I tried the below and got the following errors. I can't imagine the error on line 3 is a tag issue. Jonathan [EMAIL PROTECTED] cgi-bin]# ./uri.php ./uri.php: line 2: ?php: No such file or directory ./uri.php: line 3: syntax error near unexpected token `D' ./uri.php: line 3: `$d=date(D);' [EMAIL PROTECTED] cgi-bin]# vi uri.php [EMAIL PROTECTED] cgi-bin]# vi uri.php ?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ? - Original Message - From: Dave Goodchild To: Tijnema ! Cc: Jonathan Kahan ; php-general@lists.php.net Sent: Thursday, March 08, 2007 12:43 PM Subject: Re: [PHP] Intro to PHP question If you are running that from the command line, why do you need html? Not sure why you're doing that.
Re: [PHP] Intro to PHP question
I am not a linux expert but it might be because instead of running it like php myprogram.php you are just typing myprogram.php in which case, the file needs to have a comment in the first line telling the shell which interpreter should handle it. Some #!php or something like that, not sure. Anyway, it is just the guess of a non-expert. Satyam - Original Message - From: Jonathan Kahan [EMAIL PROTECTED] To: php-general@lists.php.net Cc: Jonathan Kahan [EMAIL PROTECTED] Sent: Thursday, March 08, 2007 5:43 PM Subject: [PHP] Intro to PHP question Hi all, I am using a linux server. When the php file below (uri.php) is run from the command line I get the following error. Any ideas on what I could do differently? Thanks for any help, Jonathan ../uri.php: line 1: syntax error near unexpected token `newline' ../uri.php: line 1: `html' html body?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ?/body /html Kind Regards Jonathan Kahan Systems Developer Estrin Technologies, inc. 1375 Broadway, 3rd Floor, New York, NY, 10018 Email: [EMAIL PROTECTED] Web: http://www.estrintech.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.7/713 - Release Date: 07/03/2007 9:24 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
AFAIK you can't run a php file directly, or you need to add #!/bin/php or something to the first line, but you can run it with php ../uri.php but i suggest you to run it from a webserver like apache. *if you don't have it, i can give you a few MB to try PHP out Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Hi all, Dave, I am attempting to use html for learning purposes. My goal is to begin working on a website. Tijnema, I tried the below and got the following errors. I can't imagine the error on line 3 is a tag issue. Jonathan [EMAIL PROTECTED] cgi-bin]# ./uri.php ./uri.php: line 2: ?php: No such file or directory ./uri.php: line 3: syntax error near unexpected token `D' ./uri.php: line 3: `$d=date(D);' [EMAIL PROTECTED] cgi-bin]# vi uri.php [EMAIL PROTECTED] cgi-bin]# vi uri.php ?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ? - Original Message - *From:* Dave Goodchild [EMAIL PROTECTED] *To:* Tijnema ! [EMAIL PROTECTED] *Cc:* Jonathan Kahan [EMAIL PROTECTED] ; php-general@lists.php.net *Sent:* Thursday, March 08, 2007 12:43 PM *Subject:* Re: [PHP] Intro to PHP question If you are running that from the command line, why do you need html? Not sure why you're doing that.
Re: [PHP] Intro to PHP question
Why not learn in a web environment if your goal is to build a website? Just create the following file: ?php phpinfo(); ? save it, upload it and view it. If you see the php details you have the system set up as you need it and can just start writing php-driven web pages (the file you are using now is one!). If you really want to run that on the command line, you will need the path to php on the first line of the file. Please, forget the command line stuff unless you want to write command line scripts, and get that file running in a web environment where it belongs. happy to help if you need any more assistance doing that!
Re: [PHP] Intro to PHP question
On 3/8/07 12:59 PM, Dave Goodchild wrote: If you really want to run that on the command line, you will need the path to php on the first line of the file. Or, he can run it through the PHP CLI with: $ php uri.php Please, forget the command line stuff unless you want to write command line scripts, and get that file running in a web environment where it belongs. happy to help if you need any more assistance doing that! What's so wrong with learning PHP from the command line? If he's comfortable with the command line, then he should be able to learn PHP from the command line. Why else does PHP have a CLI? -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Hi all, I went to a website called php-cli.com and found that i needed to type #!/usr/bin/php -q in the header line. Once I typed that, my script without the HTML tags executed. Thanks again, Jonathan - Original Message - From: Tijnema ! To: Jonathan Kahan Cc: Dave Goodchild ; php-general@lists.php.net Sent: Thursday, March 08, 2007 12:54 PM Subject: Re: [PHP] Intro to PHP question AFAIK you can't run a php file directly, or you need to add #!/bin/php or something to the first line, but you can run it with php ../uri.php but i suggest you to run it from a webserver like apache. *if you don't have it, i can give you a few MB to try PHP out Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Hi all, Dave, I am attempting to use html for learning purposes. My goal is to begin working on a website. Tijnema, I tried the below and got the following errors. I can't imagine the error on line 3 is a tag issue. Jonathan [EMAIL PROTECTED] cgi-bin]# ./uri.php ./uri.php: line 2: ?php: No such file or directory ./uri.php: line 3: syntax error near unexpected token `D' ./uri.php: line 3: `$d=date(D);' [EMAIL PROTECTED] cgi-bin]# vi uri.php [EMAIL PROTECTED] cgi-bin]# vi uri.php ?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ? - Original Message - From: Dave Goodchild To: Tijnema ! Cc: Jonathan Kahan ; php-general@lists.php.net Sent: Thursday, March 08, 2007 12:43 PM Subject: Re: [PHP] Intro to PHP question If you are running that from the command line, why do you need html? Not sure why you're doing that.
Re: [PHP] Intro to PHP question
He wanted to use it for the web, so why should he try it out on CL first? I can offer a few MBs for everyone that wants to get learning PHP. Tijnema On 3/8/07, Ben Ramsey [EMAIL PROTECTED] wrote: On 3/8/07 12:59 PM, Dave Goodchild wrote: If you really want to run that on the command line, you will need the path to php on the first line of the file. Or, he can run it through the PHP CLI with: $ php uri.php Please, forget the command line stuff unless you want to write command line scripts, and get that file running in a web environment where it belongs. happy to help if you need any more assistance doing that! What's so wrong with learning PHP from the command line? If he's comfortable with the command line, then he should be able to learn PHP from the command line. Why else does PHP have a CLI? -- Ben Ramsey http://benramsey.com/
Re: [PHP] Intro to PHP question
On 3/8/07 1:44 PM, Tijnema ! wrote: He wanted to use it for the web, so why should he try it out on CL first? Because there are some advantages to being able to run something quickly through the CLI without having to load it in a web browser. He was just doing a simple test, so the PHP CLI was perfect for the job. I can offer a few MBs for everyone that wants to get learning PHP. megabytes? -- Ben Ramsey http://benramsey.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Intro to PHP question
He wanted to use it for the web, so why should he try it out on CL first? I agree, though trying something out at the CLI may be his only option if he doesn't have/want a webserver set up. I can offer a few MBs for everyone that wants to get learning PHP. Motherboards? JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Sorry, I didn't even think about that. I use many php files as shell scripts... and u need this for any interpreter your using if you want to execute the file directly from the command line, otherwise you would have to type php scriptname.php from the command line. - Original Message - From: Jonathan Kahan [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, March 08, 2007 1:43 PM Subject: Re: [PHP] Intro to PHP question Hi all, I went to a website called php-cli.com and found that i needed to type #!/usr/bin/php -q in the header line. Once I typed that, my script without the HTML tags executed. Thanks again, Jonathan - Original Message - From: Tijnema ! To: Jonathan Kahan Cc: Dave Goodchild ; php-general@lists.php.net Sent: Thursday, March 08, 2007 12:54 PM Subject: Re: [PHP] Intro to PHP question AFAIK you can't run a php file directly, or you need to add #!/bin/php or something to the first line, but you can run it with php ../uri.php but i suggest you to run it from a webserver like apache. *if you don't have it, i can give you a few MB to try PHP out Tijnema On 3/8/07, Jonathan Kahan [EMAIL PROTECTED] wrote: Hi all, Dave, I am attempting to use html for learning purposes. My goal is to begin working on a website. Tijnema, I tried the below and got the following errors. I can't imagine the error on line 3 is a tag issue. Jonathan [EMAIL PROTECTED] cgi-bin]# ./uri.php ./uri.php: line 2: ?php: No such file or directory ./uri.php: line 3: syntax error near unexpected token `D' ./uri.php: line 3: `$d=date(D);' [EMAIL PROTECTED] cgi-bin]# vi uri.php [EMAIL PROTECTED] cgi-bin]# vi uri.php ?php $d=date(D); if ($d==Fri) echo Have a nice weekend!; else echo Have a nice day!; ? - Original Message - From: Dave Goodchild To: Tijnema ! Cc: Jonathan Kahan ; php-general@lists.php.net Sent: Thursday, March 08, 2007 12:43 PM Subject: Re: [PHP] Intro to PHP question If you are running that from the command line, why do you need html? Not sure why you're doing that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Tijnema ! wrote: I can offer a few MBs for everyone that wants to get learning PHP. Mariachi Bands! Yes, of course they can teach you how to PHP to the music and Tequila!. :) -- W | It's not a bug - it's an undocumented feature. + Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 IT Director / SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Imaging . 3550 Arapahoe Ave. #6 http://www.pcraft.com . . .. Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intro to PHP question
Dave Goodchild wrote: Of course it's possible to output raw html in a php file, that's one of it's fundamental uses! In fact, it's more efficient to switch the php parser off and send raw html as the php parser doesn't need to get involved. Just to point out, the last person did not say to output html, he said to use html. There is a big difference when working things from he CLI. each of the following examples worked for me # cat ./cli.php #!/usr/local/bin/php -q ?php echo html; echo body; echo Hello World!; echo /body; echo /html; ? # ./cli.php html body Hello World!/body/html # cat html.php html body ?php echo Hello World!; ? /body /html # php html.php html body Hello World!/body /html # cat php.php ?php echo html; echo body; echo Hello World!; echo /body; echo /html; ? # php php.php html body Hello World!/body/html -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php