If you want to run php script in shell, simply put the following line at the beginning of your php file.
#!/path/to/php
#!/path/to/php is the path you installed php in linux. If you don’t know where php is installed in your linux. Type the following command
which php
This will output the php path from your linux. The output will be something like this
/usr/bin/php
For example: hello.php
#!/usr/bin/php
<?php
echo “Hello World!”;
?>
Make your php script executable by typing
chmod +x hello.php
And then run it
./hello.php
You’ll see
Hello World!


Digg
del.icio.us
Stumbleupon
Design Float
Subscribe with RSS
email subscription
Add me to Technorati
LinkedIn
Facebook
Twitter


No Comments (including trackbacks)
Leave a Reply
I always welcome your valuable comments, positive or negative, and suggestions. Because I believe that comments are energy that keep me up my blogging. If you comment for the first time in my blog, your comment will be in moderated for approval. You can keep post your comment without moderation once your comment has been approved. If your comment contains more than two hyperlinks, it will be held in the moderation queue. Your name and home url will be displayed in your comment and your IP and your email will be keep secret and will not be sold or share to anyone, I promise.