Quote:
Originally Posted by jiml8
php myscript.php
What happens then just depends on what the script does; could be useless. For the case you decribe, it should work OK.
|
you can go a step further and actually make the PHP script executable... same way you do a CGI or PerL file...
Start the php script with: #!/usr/bin/php (or whatever your path to PHP is)
and make sure to leave at LEAST one blank line after it or the first line: <?php (most important) will not be parsed and the entire thing will not work.
Example:
#!/usr/bin/php
<?php
//just a test script
echo "hello world!\n";
?>
Save that as just plain "myscript" then "CHMOD 755 myscript", and finally "./myscript", VIOLA! You wrote your first shell php script, (I write tons of them, I don't like perl, not enough web integration.)