Thanks, that did it. And yes, I am trying to run this as a shell script. Thank you very much.
John.
----- Original Message ----- From: "John Nichel" <[EMAIL PROTECTED]>
To: "John A. Thomason" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, July 12, 2003 10:01 PM
Subject: Re: [PHP] OK, So I am new to these List. Win2000 help!
John A. Thomason wrote:the
The following is my output in the command prompt window(DOS Prompt?)
C:\PHP>hello.php Content-type: text/html X-Powered-By: PHP/4.3.2
!#C:\php\; echo"Hello World!"; if ($foo): echo "yep\n"; elseif ($bar): echo "almost\n"; else: echo "nope\n"; endif; phpinfo(); C:\PHP>
And the following is the PHP code to generate it.
!#C:\php\;
echo"Hello World!";
if ($foo):
echo "yep\n";
elseif ($bar):
echo "almost\n";
else:
echo "nope\n";
endif;
phpinfo();
Now, I know that the variables are not set, so they should be false, but
theoutput just displays a "listing" of the code and doesn't process it. In
like adocumentation, it states that PHP can be run from the command prompt,
batch file. Now what am I doing wrong.
I do have it working correctly with an Apache server, that I am using backend.
and my install dir is "C:\php", and it is listed first in the path.
John A. Thomason
[EMAIL PROTECTED]
Looks like you're trying to run it as a shell script, or a cgi program. Replace the sh-bang on the first line with <?php and make sure the last line of the script is ?>
eg:
<?php echo"Hello World!"; if ($foo): echo "yep\n"; elseif ($bar): echo "almost\n"; else: echo "nope\n"; endif; phpinfo(); ?>
Yeah, you just need to enclose the actual script in the opening/closing php tags (<?php and ?>). And to run it as a shell script, you can either call the script as...
c:\path\to\php\php.exe filename.php (or just 'php filename.php' if the php interperter is in your path), or put the sh-bang as the first line (before the opening php tag).
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php