开发者

shell command meaning and htaccess file?

开发者 https://www.devze.com 2023-03-01 06:26 出处:网络
#!/bin/sh exec /usr/local/cpanel/cgi-sys/php5 this command is in a fi开发者_Go百科le called php.fcgi. i don\'t know what\'s the meaning.
#!/bin/sh
exec /usr/local/cpanel/cgi-sys/php5

this command is in a fi开发者_Go百科le called php.fcgi. i don't know what's the meaning.

AddHandler php-fastcgi .php
Action php-fastcgi /cgi-bin/php.fcgi

the above command in in the .htaccess file, what's the meaning of them. thank you.


The first line defines that the file is to be executed by command /bin/sh which is Unix shell. Next line, shell command exec is an argument, executes it and replaces the current shell with that process (i.e the shell script will stop at that point).

#!/bin/sh
exec /usr/local/cpanel/cgi-sys/php5

Together this means that it is a shell-script wrapper to execute PHP5 binary.

In the .htaccess the first line defines a handler named php-fastcgi for all files ending in .php:

AddHandler php-fastcgi .php

Second line defines that the handler php-fastcgi can be found at the location /cgi-bin/php.fcgi:

Action php-fastcgi /cgi-bin/php.fcgi

Note that this is not filesystem location, but URL path, which is further parsed by Apache to find actual filesystem location (ScriptAliases, Aliases, etc).

All of this together means that .php files are executed with above shell script, which in turn runs PHP5 binary.

0

精彩评论

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