470,815 Members | 1,123 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

execute ph script

Greetings,

I need to execute a php script in my shell so :

touch test.php
chmod +x test.php
edited the file, inserted the following lines :

#! /usr/bin/php -q
$a = 0;
echo $a;
../test.php

Gives me the following output :

$a = 0;
echo $a;

What did I forget ??

many thx !
Jul 17 '05 #1
2 1751
charly wrote:
I need to execute a php script in my shell so :

touch test.php
chmod +x test.php
edited the file, inserted the following lines :

#! /usr/bin/php -q
$a = 0;
echo $a;
./test.php

Gives me the following output :

$a = 0;
echo $a;

What did I forget ??


The php tags. Without them the contents are taken as text/html.

$ nl test.php
1 #! /usr/bin/php
2 <?php
3 $a = 0;
4 echo $a;
5 ?>

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
>
The php tags. Without them the contents are taken as text/html.

$ nl test.php
1 #! /usr/bin/php
2 <?php
3 $a = 0;
4 echo $a;
5 ?>


Great, I didn't know they were required, thought it worked like in perl.

Many many thx !
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Tomasz Ludwiniak | last post: by
3 posts views Thread by Lyle Fairfield | last post: by
5 posts views Thread by batham | last post: by
4 posts views Thread by Chr1s | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.