chrithccmc chrithccmc - 1 month ago 5
Bash Question

running php script (php function) in linux bash

How we run php script using linux bash ?

php file test.php

test.php contain.

<?php echo "hello\n" ?>

Answer

From the command line enter this: php -f filename.php

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).