473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

command-line php displays code instead of executing code

I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.

How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil

Jan 28 '07 #1
12 9126
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.

How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php

Your code must be surrounded with <?php and ?>, just like in a web page.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 28 '07 #2


On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php
>
Your code must be surrounded with <?php and ?>, just like in a web page.
install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the source
code instead of the executions.

Phil
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Jan 28 '07 #3
comp.lang.php wrote:
>
On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>comp.lang.php wrote:
>>I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil

php example.php
>Your code must be surrounded with <?php and ?>, just like in a web page.

install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the source
code instead of the executions.

Phil
>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Then it should work. Or at least it does on every system I've used.

But since you haven't posted the script or anything else about your
installation, any answer is a guess.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 28 '07 #4


On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php
Your code must be surrounded with <?php and ?>, just like in a web page.
install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the source
code instead of the executions.
Phil
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on every system I've used.

But since you haven't posted the script or anything else about your
installation, any answer is a guess.

I tried with a very simple one-liner script:

<?php

print_r("hello world");

?>

And that is exactly what I see instead of "hello world"

Phil
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Jan 28 '07 #5
comp.lang.php wrote:
On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>comp.lang.php wrote:
>>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw
code instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
>>php example.php
Your code must be surrounded with <?php and ?>, just like in a web
page.
>>install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the
source code instead of the executions.
>>Phil
>>>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on
every system I've used.

But since you haven't posted the script or anything else about your
installation, any answer is a guess.


I tried with a very simple one-liner script:

<?php

print_r("hello world");
>>

And that is exactly what I see instead of "hello world"

Phil
You said earlier that your code was "surrounded with PHP tags", but what you
have posted has no ending tag.
Jan 28 '07 #6


On Jan 28, 3:18 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
comp.lang.php wrote:
On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw
code instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
>php example.php
Your code must be surrounded with <?php and ?>, just like in a web
page.
>install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the
source code instead of the executions.
>Phil
>>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on
every system I've used.
But since you haven't posted the script or anything else about your
installation, any answer is a guess.
I tried with a very simple one-liner script:
<?php
print_r("hello world");
And that is exactly what I see instead of "hello world"
PhilYou said earlier that your code was "surrounded with PHP tags", but what you
have posted has no ending tag.
blah.php:

<?php print_r("hello world"); ?>

That is literally what I have. The end tag didn't paste onto this
message thread for some wacko reason, however, it still prints out
source code instead of "hello world"

Jan 28 '07 #7
comp.lang.php wrote:
>
On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>comp.lang.php wrote:
>>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php
Your code must be surrounded with <?php and ?>, just like in a web page.
install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the source
code instead of the executions.
Phil
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on every system I've used.
But since you haven't posted the script or anything else about your
installation, any answer is a guess.


I tried with a very simple one-liner script:

<?php

print_r("hello world");

?>

And that is exactly what I see instead of "hello world"

Phil
OK, and you are entering from a command line:

php example.php

-q shouldn't affect the execution of the program, but you should try
leaving it off.

Also, ensure you don't have ANY other file with the filename "php" - it
could be php.exe, php.bat or php.com, for instance.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 28 '07 #8
Rik
Paul Lautman <pa**********@btinternet.comwrote:
><?php

print_r("hello world");
>>>

And that is exactly what I see instead of "hello world"

Phil
You said earlier that your code was "surrounded with PHP tags", but what
you
have posted has no ending tag.
Oh yes there was. Please do not trust Google Groups in this... It has the
tendancy to replace ?on the first line to a simple >

Unfortunately, I have no further insights for the OP.
--
Rik Wasmus
Jan 28 '07 #9


On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php
Your code must be surrounded with <?php and ?>, just like in a web page.
install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the source
code instead of the executions.
Phil
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on every system I've used.
But since you haven't posted the script or anything else about your
installation, any answer is a guess.
I tried with a very simple one-liner script:
<?php
print_r("hello world");
?>
And that is exactly what I see instead of "hello world"
PhilOK, and you are entering from a command line:

php example.php

-q shouldn't affect the execution of the program, but you should try
leaving it off.

Also, ensure you don't have ANY other file with the filename "php" - it
could be php.exe, php.bat or php.com, for instance.
Nope, all there is is php.exe, I checked
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Jan 28 '07 #10
comp.lang.php wrote:
>
On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>comp.lang.php wrote:
>>On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>comp.lang.php wrote:
>>I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
>>instead of executing my script, it's actually displaying the raw code
>>instead.
>>How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
>>Thanx
>>Phil
php example.php
>Your code must be surrounded with <?php and ?>, just like in a web page.
install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the source
code instead of the executions.
Phil
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstuck...@attglobal.net
>==================Then it should work. Or at least it does on every system I've used.
But since you haven't posted the script or anything else about your
installation, any answer is a guess.
I tried with a very simple one-liner script:
<?php
print_r("hello world");
?>
And that is exactly what I see instead of "hello world"
PhilOK, and you are entering from a command line:
php example.php

-q shouldn't affect the execution of the program, but you should try
leaving it off.

Also, ensure you don't have ANY other file with the filename "php" - it
could be php.exe, php.bat or php.com, for instance.

Nope, all there is is php.exe, I checked
>--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Well, if everything is as you say, it should work. It does on every
system I've used.

Obviously there is something else going on, or something you're not
telling us - probably because you don't know - but there's something
different.

It does work.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 29 '07 #11
On Sun, 28 Jan 2007 13:17:21 -0800, comp.lang.php
<ph**************@gmail.comwrote:
>

On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>comp.lang.php wrote:
On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
>>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw
code
>>>>instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php
Your code must be surrounded with <?php and ?>, just like in a web
page.
>>install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the
source
>>code instead of the executions.
Phil
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on
every system I've used.
>But since you haven't posted the script or anything else about your
installation, any answer is a guess.
I tried with a very simple one-liner script:
<?php
print_r("hello world");
?>
And that is exactly what I see instead of "hello world"
PhilOK, and you are entering from a command line:

php example.php

-q shouldn't affect the execution of the program, but you should try
leaving it off.

Also, ensure you don't have ANY other file with the filename "php" - it
could be php.exe, php.bat or php.com, for instance.

Nope, all there is is php.exe, I checked
>>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
What version of PHP are you using? If you're using PHP 4, then you need to
use the php-cli.exe executable, rather than php.exe. Also, there is a CLI
related DLL that needs to be in the same directory.

Also, is your PHP installation running on a server? If so, do you have the
same problem?

--
Curtis
Feb 1 '07 #12
On Jan 31, 9:35 pm, Curtis <dyers...@verizon.netwrote:
On Sun, 28 Jan 2007 13:17:21 -0800, comp.lang.php

<phillip.s.pow...@gmail.comwrote:
On Jan 28, 3:34 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
On Jan 28, 2:56 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
>On Jan 28, 1:58 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
comp.lang.php wrote:
I am using CLI PHP to run a PHP script, c:\wamp\php\php.exe, but
instead of executing my script, it's actually displaying the raw
code
instead.
How can I run my code using CLI PHP? I installed WAMP5 on WinXP.
Thanx
Phil
php example.php
Your code must be surrounded with <?php and ?>, just like in a web
page.
install.php is indeed surrounded with PHP tags, just like in a web
page. As I can see when I do "php -q install.php" and see the
source
code instead of the executions.
Phil
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================Then it should work. Or at least it does on
every system I've used.
But since you haven't posted the script or anything else about your
installation, any answer is a guess.
I tried with a very simple one-liner script:
<?php
print_r("hello world");
?>
And that is exactly what I see instead of "hello world"
PhilOK, and you are entering from a command line:
php example.php
-q shouldn't affect the execution of the program, but you should try
leaving it off.
Also, ensure you don't have ANY other file with the filename "php" - it
could be php.exe, php.bat or php.com, for instance.
Nope, all there is is php.exe, I checked
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

What version of PHP are you using? If you're using PHP 4, then you need to
use the php-cli.exe executable, rather than php.exe. Also, there is a CLI
related DLL that needs to be in the same directory.
Sorry using PHP 5.2.0
>
Also, is your PHP installation running on a server? If so, do you have the
same problem?
I am using WAMP5, if that helps you any. I have to use this option to
get it to work:

php -d short_open_tag=on -q "/path/to/my.php"

Phil
>
--
Curtis

Feb 9 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
8
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
15
by: Sokar | last post by:
Hello, I am writing a script which is using the system() command. In the script the system command invokes an encryption with system("gpg -f file.txt"). The problem comes when the script is...
2
by: Raquel | last post by:
Why can we not give db2 System commands (commands starting with 'db2' like db2ilist, db2look, db2move etc.) through the Command Center? It is so convenient to retrieve and change commands in the...
12
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the...
4
by: FluffyCat | last post by:
New on November 29, 2005 for www.FluffyCat.com PHP 5 Design Pattern Examples - the Command Pattern. Since you all enjoyed the Visitor Pattern so much yesterday, today I have the Command Pattern...
5
by: Good Man | last post by:
Hi there I am trying to execute a custom-built java program on my linux server via PHP. Basically, a user uploads files via PHP, and then the java program performs some action on these files. ...
11
by: jobs239 | last post by:
Can I use this line inside C program "system(java -jar <jarfilename>)" to run a java program from C? Or do I have to use some JNI interface.?
5
by: Odd Bjørn Andersen | last post by:
I have installed DB2 9 Enterprise Edition on my laptop and created the sample database. Now I'm having truble connecting to the database from Command Editor. If I connect from Command Window it's...
2
by: Gil_H | last post by:
Hi, I'm trying to run a script over unix on a remote machine. In order to automate it, the procedure requests the following: 1. Using SSH connection. 2. Operating a command on the remote...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.