Exec command

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to: navigation, search
← Compound commandHomeChapter 8 Challenges →
exec 3> /tmp/output
  • The exec command is used by "wrapper" scripts. For example, php-cgi can run as cgi program after setting environment variables or other configuration.
  • By using exec, the resources used by the php.cgi shell program do not need to stay in use after the program is started. The following script can be run using Apache web server and it will speed up php execution:
# Shell Script wrapper to Run PHP5 using mod_fastcgi under Apache 2.2.x
# Tested under CentOS Linux and FreeBSD and 7.x server.
# for centos / rhel set it as follows
# PHP_CGI=/usr/bin/php-cgi
exec $PHP_CGI
← Compound commandHomeChapter 8 Challenges →