I used phpxxx. php to run this php script. in linux, I want to use. xxx. sh to replace it. I wonder if it is feasible? Php xxx. php is used to run this php script.
In linux
I want to use./xxx. sh instead of above
Is it feasible?
Reply content:
Php xxx. php is used to run this php script.
In linux
I want to use./xxx. sh instead of above
Is it feasible?
Feasible,
#!/bin/bash# author: gm100861PHP=/usr/local/php/bin/php$PHP youphpfilename.php
You want to execute the php script directly.
1. Add # At the beginning of xxx. php #! /Usr/local/php/bin/php2.chmod + x xxx. php3../xxx. php
The shell you are using.
If it is bash, there is no good way to pass the file name to shell and then call php to run it.
For zsh, You can edit. zshrc and use the alias-s command to specify the command to be executed when you directly enter *. php. For example:
Alias-s php = 'php' # Run in shell input *. php
Alias-s php = 'vim '# open it when shell input *. php
Alias-s php = 'php-l' # Check the syntax error when entering *. php In shell
Yes. It can be called in the same shell script.php ***.php
You can also use crontab to specify the execution time and period.
Http://segmentfault.com/q/1010000003731015/a-1020000003732913