开发者

Understanding a bourne shell script

I came across a wrapper script to run php as fastcgi, could someone explain what is 开发者_运维知识库going on in the script?

#!/bin/sh
exec /usr/bin/php5-cgi -c /etc/php5/cgi/php-fcgi.ini


The first line (sha bang or hash bang) set the interpreter, in this case /bin/sh the standard shell, this is not necessarily a bourne shell.

The script is probably used to start a php-cgi session with a custom config file.

The -c flag is used to select a configuration file . .

try /usr/bin/php5-cgi --help for more information on available flags.


Not much. It executes /usr/bin/php5-cgi with the parameter -c /etc/php5/cgi/php-fcgi.ini, i.e. it specifies a special configuration file.


The script replaces itself (exec), keeping the pid, by executing usr/bin/php5-cgi -c /etc/php5/cgi/php-fcgi.ini

If it did not use exec, whoever called it would not get the process ID of the php5-cgi process. Likely this script is intended as a drop-in replacement for executing php directly, and whatever uses this script needs the process ID of the php process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜