Tuesday, November 2, 2010

How to run PHP in shell script?



1. Find the path PHP installed in Linux 
which php
normally return : /usr/bin/php
2. write a test.php:
#!/usr/bin/php
<?
echo "   run in shell scritpt \n";
phpinfo();
?> 
3. Make the php script executable by typing:
chmod +x test.php
4.  Run the script:
./test.php

No comments:

Post a Comment