How we run php script using linux bash ?
php file test.php
test.php contain.
<?php echo "hello\n" ?>
|
From the command line enter this:
Make sure that filename.php both includes and executes the function you want to test. Anything you echo out will appear in the console including errors. Be wary that often the php.ini for Apache PHP is different from CLI PHP (command line interface). |
|||
|
There are two ways you can do this. One is the one already mentioned, i.e.:
The second option is making the script executable (
I'm not sure though if a webserver likes this, so if you also want to use the .php file in a website, that might not be the best idea. Still, if you're just writing some kind of script, it is easier to type |
|||||||
|
First of all check to see if your PHP installation supports CLI. Type:
|
|||
|
See the manual for full details of running PHP from the command line |
|||
|