Reputation: 4878
I have a php script (functions.inc):
<?php
function exec_mount_secured_bucket(){
exec("/ilantest/testscript.sh");
}
?>
I would like to run that function from inside the shell, normally to run the script using php i would do:
php function.inc
But I want to call a certain function from that function file.
How to do it ?
Thanks.
Upvotes: 2
Views: 411
Reputation: 20550
You can use the command line switches for this purpose:
--process-end code
-E code Run PHP code after processing all input lines
This should do the job:
php -E 'exec_mount_secured_bucket();' function.inc
Upvotes: 4
Reputation: 19118
Create a file like this:
launcher.php
<?php
include 'functions.inc';
exec_mount_secured_bucket();
Then in your bash script:
php launcher.php
Upvotes: 1